8000 Recognize pandas Timestamp objects for DateConverter? · Issue #10533 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
Recognize pandas Timestamp objects for DateConverter? #10533
Closed
@jorisvandenbossche

Description

@jorisvandenbossche

I am testing matplotlib 2.2rc from a point of view of "what if pandas no longer registers its unit converters", and one of the issues raised when we temporarily did that for the 0.21.0 release was the following (pandas-dev/pandas#18283):

Code for reproduction

import pandas as pd
import matplotlib.pyplot as plt

pd.plotting.deregister_matplotlib_converters()

xticks = pd.date_range(start="10/10/2017", end="11/11/2017",
                       freq='D')
plt.xticks(xticks, xticks.strftime("%a %m-%d"))

Actual outcome

The above raises TypeError: Cannot compare type 'Timestamp' with type 'float', because Timestamps are not recognized to use the DateConverter in the units framework.

Would it be possible to consider adding pandas Timestamps to the unit registry? It are subclasses of datetime.datetime, so code-wise it should not be hard to add support.

Matplotlib version

  • Operating system: Linux
  • Matplotlib version: '2.2.0rc1'
  • Python version: 3.5

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0