Note
Click here to download the full example code
12.3.10.4.2. Missing dataΒΆ
import pandas as pd
import numpy as np
dates = pd.date_range("20220501", periods=6)
dataFrame = pd.DataFrame(np.random.randn(6, 4), index=dates, columns=list("ABCD"))
Missing data
dataFrame1 = dataFrame.reindex(index=dates[0:4], columns=list(dataFrame.columns) + ["E"])
dataFrame1.loc[dates[0] : dates[1], "E"] = 1
dataFrame1.dropna(how="any")
dataFrame1.fillna(value=5)
pd.isna(dataFrame1)
Total running time of the script: ( 0 minutes 0.016 seconds)