【发布时间】:2020-02-18 17:53:33
【问题描述】:
df
import pandas as pd
df = pd.DataFrame({
'SKU': ['BIKES','MATS', 'BLANKETS', 'CREAMS'],'Col1': [1,3,6,10],'Col2': [4,5, 6,16],'Month':[1,2,3,4],'Year':['2015','2010','2011','2012']})
代码尝试了,但不起作用
import matplotlib.pyplot as plt
#Visualisations
fig, ax = plt.subplots()
for col in ['Col1', 'Col2']:
ax.plot(df[col], label=col)
ax.legend(loc="best")
ax.tick_params(axis="x", rotation=30)
我需要几个月的代码和几年的值。但在我可以继续使用代码等之前,我收到了错误:
File "<ipython-input-14-136f7818ccc7>", line 6
for col in ['Col1', 'Col2']:
^
SyntaxError: EOL while scanning string literal
【问题讨论】:
-
这一行的引号有误:
" ’ ‘ ’- 你需要" "或' '