-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Description
With pandas 0.21.0, the following fails (whereas it works fine with pandas 0.20.3):
import pandas as pd
import seaborn as sns
index = pd.date_range('2017-06-01', periods=16)
df = pd.DataFrame(index=index, columns=['a', 'b', 'c'])
df.iloc[:2, 0] = '1000'
df.iloc[[2, 3, 6, 8, 10, 12, 14, 15], 1] = '1000'
df.iloc[[4, 5, 9, 13], 2] = '1000'
df.iloc[[7, 11], 1] = '1001'
df.index.name = 'Datetime'
df.columns.name = 'Element'
df = df.stack().rename('Event').reset_index()
df['Event / Element'] = df['Event'] + ' / ' + df['Element']
sns.stripplot(x='Datetime', y='Event / Element', hue='Element', data=df, orient='h')
The reason is that pandas no longer registers the matplotlib converter for datetimes on import.
The fix is to explicitly register the converters before plotting:
from pandas.tseries import converter
converter.register()
The same fix has been implemented in xarray for a similar issue: pydata/xarray#1661.
I reported this to pandas as pandas-dev/pandas#18212.
Metadata
Metadata
Assignees
Labels
No labels