简体   繁体   English

未绘制熊猫数据

[英]Pandas data not being plotted

I have the following simple code to plot specific data sets from this file https://easyupload.io/mdci9u我有以下简单的代码来绘制此文件中的特定数据集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.当我打印df1一切似乎都很好。

I am using Jupyter Notebook.我正在使用 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) axs.plot(x,y)

Instead, you have used an equal sign which is why you got an empty graph.相反,您使用了等号,这就是为什么您得到一个空图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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