'Pandas DataFrame All Values Missing [duplicate]
I am using a dataset of 962 rows with 0 missing values, but when I run isnull() on it, I get as a result that the whole dataset is empty.
from statsmodels.tsa.seasonal import seasonal_decompose
import pandas as pd
from matplotlib import pyplot
ts = pd.read_excel("test.xlsx")
df = pd.DataFrame(ts)
df.set_index('date', inplace=True)
df.index = pd.to_datetime(df.index)
print(df.isnull().count())
Output on the kernel:
date 962
tmax (degC) 962
tmin (degC) 962
af (days) 962
rain (mm) 962
sun (hrs) 962
dtype: int64
Any clue what is happening here?
Solution 1:[1]
Change count to sum, count will return not NaN value number total, in your case you need count the number of NaN, so we do sum
print(df.isnull().sum())
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | BENY |
