Seaborn doesn't support PeriodIndex
See original GitHub issueSeaborn doesn’t properly support pandas PeriodIndex: dates should be converted to their actual values before being plotted.
import pandas as pd #Pandas 0.18.1
import seaborn as sns #Seaborn 0.7.0
index = pd.PeriodIndex(start='2000', end='2005', freq='A')
df = pd.DataFrame(np.random.randint(0,10,(len(index), 2)), index=index, columns=['A', 'B'])
sns.heatmap(df)

I’m not familiar with PRs, I guess there’s not much to change as converting the PeriodIndex to a regular datetime type does the trick
sns.heatmap(df.pipe(lambda x: x.set_index(x.index.to_datetime())))
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Making `matplotlib.pyplot.plot()` work with `PeriodIndex
OrderQuantity.plot() is not an option because I am trying to have multiple dataframes on the same graph (test and training data), and some ......
Read more >Frequently asked questions — seaborn 0.12.1 documentation
Because seaborn is pure Python, it won't directly encounter these problems, but its dependencies (numpy, scipy, matplotlib, and pandas) might.
Read more >Working with Time Series | Python Data Science Handbook
This encodes a fixed-frequency interval based on numpy.datetime64 . The associated index structure is PeriodIndex . For time deltas or durations, Pandas ...
Read more >Working with Time Series in Pandas - Medium
There may be strings in the index that do not represent a date. ... Period and PeriodIndex objects can be converted to another...
Read more >Time Series Data Visualization with Python
Sometimes it can help to change the style of the line plot; for example, ... not all problems with data say having typical...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

pandas:
1.4.2matplotlib:3.5.2Python:3.10.2BTW Seaborn is great. Good docs too, things are nicely explained.
Weird, what version of pandas / matplotlib are you on?
Agreed that this is really something that should be made to work better in pandas.