Skip to content

Conversation

@jklymak
Copy link
Contributor

@jklymak jklymak commented Jul 20, 2020

converter._dt_to_float_ordinal(dt) special cased datetime64 objects, and used matplotlib.dates.epoch2num. However, matplotlib has supported datetime64 natively since Matplotlib 2.2 (matplotlib/matplotlib#9779), so this special casing shouldn't be necessary (unless there is a subtlety I'm missing). Matplotlib would also prefer to deprecate epoch2num, so this would help us streamline.

I didn't check your support policy - if you need to support pre MPL 2.2, then I guess some try/except logic will need to go in here.

ping @TomAugspurger @dstansby

@TomAugspurger
Copy link
Contributor

Thanks. I'm looking into this a bit too. Will take a closer look later.

@jklymak
Copy link
Contributor Author

jklymak commented Jul 21, 2020

So, pandas has a quasi-public API at

def convert(value, unit, axis):
that gets tested in test_converter.py and assumes a matplotlib epoch of 0000-12-31. Most plotting seems OK with the change in this PR, but the hard-coded tests that assume the epoch is the same as datetime.toordinal() naturally fail. Not sure how you want to handle this dance - I think it would be easiest from the users point of view to just use the Matplotlib epoch and adjust the test (and the quasi-public results of calling convert). But I don't claim expertise in how pandas users are used to handling datetime objects.

@TomAugspurger
Copy link
Contributor

Thanks for starting on this @jklymak. I've incorporated it into #35393.

@jklymak jklymak deleted the fix-remove-epoch2num branch July 23, 2020 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: epoch2num matplotlib deprecation warning

2 participants