Skip to content

VIS: NaN Handling in Pie Plots #8198

Closed
@TomAugspurger

Description

@TomAugspurger

From #8177 (comment), how should we handle NaNs in Pie Plots. Right now the documented behavior is to fill 0s and plot. This can result in some unattractive labeling depending on where the NaNs are at in the series.

In [11]: series = Series(3 * np.random.rand(8), index=['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'], name='series')
In [15]: series.iloc[:4] = np.nan

In [16]: series.plot(kind='pie')
Out[16]: <matplotlib.axes._subplots.AxesSubplot at 0x11183e128>

nana

This is actually the first case where I can see a use for a NaN-handling kwarg in *.plot() itself. You could reasonably want to

  • Drop the NaNs (which I think should be the default)
  • Fill 0s (shows they're missing, but makes the labeling confusing)
  • Aggregate the NaNs and put those in a separate "missing" wedge that takes up some proportion of the pie.

I've got no idea how that proportion should be calculated (counts? relative to the sum or size?).

For now let's just decide if the default should change from filling 0s to filling dropping (with a couple releases of notice.)

cc @jorisvandenbossche @sinhrks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions