0

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?

1

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.