Reputation: 71
I am trying to build a Pandas series by passing it a dictionary containing index and data pairs. While doing so I noticed an interesting quirk. When the dictionary contains NaN
keys with an associated value, pandas Series retains the NaN
key in the index but sets the corresponding value to NaN
as well.
import pandas as pd
d = {np.nan: 3500.0, 66485174.0: 1.0}
d = pd.Series(d, dtype='float64')
In the example above, 3500.0
will be set to NaN
by pd.Series
.
I am using pandas 0.20.2 with python 2.7.
Does anyone know why this happens? My intuition is that NaN
is probably seen as a infinite number beyond 64-bit, hence there might be some format issues
Upvotes: 4
Views: 370