Tuesday, 20 August 2013

How to prevent automatic conversion to float of pandas Series when nan is added to it?

How to prevent automatic conversion to float of pandas Series when nan is
added to it?

I am adding data to a pandas series via the Series#append method.
Unfortunately, when nan is added to a bool series, it is automatically
converted to a float series. Is there any way to avoid it?
>>> Series([True])
0 True
dtype: bool
>>> Series([True]).append(Series([np.nan]))
0 1
0 NaN
dtype: float64

No comments:

Post a Comment