0

I have Tried this , but not working and giving error .

the error is: ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), #a.any() or a.all().

df = pd.DataFrame(np.random.randn(5,5))
df[df > 0.9] = pd.np.nan
df.columns = ['a','b','c','d','e']
a=df.a
for column in df.columns:
    if df.a.isnull()=='true':
        column=np.random.randn(7,11)enter code here

Community
  • 1
  • 1
  • 2
    You can use the `fillna()` method for replacing NaN values. `df['column'] = df['column'].fillna(your_value)` – user9940344 Apr 09 '20 at 11:34
  • https://pandas.pydata.org/pandas-docs/stable/user_guide/missing_data.html there is a method called df.isna, check this out – Exi Apr 09 '20 at 11:34
  • 1
    Does this answer your question? [How can I replace all the NaN values with Zeros in a column of a pandas dataframe](https://stackoverflow.com/questions/13295735/how-can-i-replace-all-the-nan-values-with-zeros-in-a-column-of-a-pandas-datafram) – Bruno Mello Apr 09 '20 at 11:37

0 Answers0