简体   繁体   中英

Pandas data not being plotted

I have the following simple code to plot specific data sets from this file https://easyupload.io/mdci9u

import pandas as pd
import matplotlib.pyplot as plt

url=r'/path_to_file/Book.xlsx'

df1  = pd.read_excel(url, sheet_name=0,sep='\s*,\s*', index_col=0)
print(df1) 
x=df1.iloc[:,11].values.tolist()
y=df1.iloc[:,17].values.tolist()
print(x)
fig, axs=plt.subplots(figsize=(12,5))

axs.plot=(x,y)

Whenever I try to run the code, only an empty graph with no data plotted appears. I cannot troubleshoot why my data is not being plotted. Is it something related to my dataframe? When I print df1 everything seems just fine.

I am using Jupyter Notebook.

Could someone try to help me understand the problem?

All help is very much appreciated!

Thanks!

You made a mistake in the last line . It should be

axs.plot(x,y)

Instead, you have used an equal sign which is why you got an empty graph.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM