Skip to content

VIS: DataFrame.plot drops datetime data when kind is scatter #8113

Closed
@TomAugspurger

Description

@TomAugspurger

This works fine:

In [13]: df = pd.DataFrame(np.random.randn(300), columns=['a'])
In [14]: df['dtime'] = pd.DatetimeIndex(start='2014-01-01', freq='h', periods=300).time
In [15]: df.plot(x='dtime', y='a')
Out[15]: <matplotlib.axes._subplots.AxesSubplot at 0x118fd17f0>

This raises a KeyError

In [17]: df.plot(x='dtime', y='a', kind='scatter')

We call df._get_numeric_data() which excludes datetimes.
May happen for other kinds too.

I'll fix this; just have to decide how much refactoring.

Matplotlib is ok with datetime.time values, it chokes on datetime values.

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