You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Most help documents I've seen suggest using the fillna() function to fill a DataFrame. However, if you try to use the results of that fill operation with other functions, it can break. For example, the following code:
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/pandas/core/generic.py", line 827, in cumsum
mask = np.isnan(self.values)
TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
However, creating a DataFrame filled with ones using the following works just fine:
Most help documents I've seen suggest using the fillna() function to fill a DataFrame. However, if you try to use the results of that fill operation with other functions, it can break. For example, the following code:
df = DataFrame(index=["A","B","C"], columns = [1,2,3,4,5]) df2 = df.fillna(1) df2.cumsum()
Fails with the following error message:
However, creating a DataFrame filled with ones using the following works just fine:
df = DataFrame(np.ones((3,5)),index=["A","B","C"], columns = [1,2,3,4,5])
The text was updated successfully, but these errors were encountered: