Missing Data#
Just like pandas
has built-in settings for handling missing data or NaN
values, the .plot()
method also has default settings for how each type of plot handles missing data.
Plot Type |
NaN Handling |
---|---|
Line |
Leaves gaps |
Stacked line |
Fills 0s |
Bar |
Fills 0s |
Scatter |
Drops missing values |
Histogram |
Drops missing values (column-wise) |
Box |
Drops missing values (column-wise) |
Area |
Fills 0s |
Kernel density (KDE) |
Drops missing values (column-wise) |
Hexbin |
Drops missing values |
Pie |
Fills 0s |
To customize or alter these default settings, you would use .fillna()
or .dropna()
to filter the DataFrame
before generating the plot.
Additional Resources#
For more on plotting with pandas
and matplotlib
: