Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
84 views
in Technique[技术] by (71.8m points)

python - Pandas.plot does not plot all of row of a Series object

I have a small sample code as below

import pandas as pd
import matplotlib.pyplot as plt

temperatures = [4.4,5.1,6.1,6.2,6.1,6.1,5.7,5.2,4.7,4.1,3.9,3.5]
dates = pd.date_range('2016/10/29 5:30pm', periods=12, freq='H')
temp_series = pd.Series(temperatures, dates)

temp_series.plot(kind="bar")

I want my plot to be like this:

Expectation

(I tested it on google colab and it worked)

However, on my computer it turned out to be like this:

Plot on my computer

I suspected there might be some issue with pandas and matplotlib recent versions. However, I am still new to pandas so I don't really know how to debug this. My python is 3.9.0, pandas is 1.2.0, and matplotlib is 3.3.2.

question from:https://stackoverflow.com/questions/65876619/pandas-plot-does-not-plot-all-of-row-of-a-series-object

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

So I tried downgrading my pandas version from 1.2.0 to 1.1.5 and now it works. However, this is only a temporary solution by now. I would be very grateful if someone can explains this issue and how to actually fix it in the new version.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...