Dong-gyun Kim
Dong-gyun Kim

Reputation: 431

Pandas Dataframe empty value's type issue

Let's say there's an empty cell in a data frame. If I print out the type of the empty cell, It prints out:

<class 'float'> nan

Why does it print out the type as class 'float'?

And if a cell has nan value in a cell and the other cell has empty, can I handle these two cells as same as NaN value in it?

Upvotes: 0

Views: 94

Answers (1)

Udit Hari Vashisht
Udit Hari Vashisht

Reputation: 549

NaN is a special value which is part of the IEEE floating-point specification. Hence, when you will check the type of NaN it will show it as a float.

The empty cell will be using Pythonic Missing data value i.e. None, so it is advisable to use pandas.fillna for comparing two cells.

Upvotes: 2

Related Questions