python - 如何在 Google Colab 中使用 matplotlib 避免格式错误?
问题描述
代码错误 我正在尝试从谷歌 Colab 中的 csv 绘制时间序列数据,并收到以下错误:
ValueError:格式字符串中无法识别的字符a
这是我的代码:
df = pd.read_csv("/content/drive/My Drive/hospital project/fastpass stuff.csv")
df.date = pd.to_datetime(df['date'])
df_all_units = df.groupby([pd.Grouper(key='date', freq='30min')]).size().reset_index(name='number of events')
df_all_units.to_csv("/content/drive/My Drive/hospital project/all_units.csv")
from matplotlib import pyplot as plt
plt.figure()
plt.plot('number of events', 'date')
plt.title('Visitors Over Time')
plt.xlabel('Time')
plt.ylabel('Number of Visitors')
#plt.show()
解决方案
推荐阅读
- javascript - 分别打印元音和辅音的代码不起作用
- javascript - 如何创建一个功能,当我单击删除时,它会问我...在 html
- php - 为什么此表单张贴到错误的路径
- python-3.x - 如何检索执行 .exe 文件或打开 .pdf 文件所花费的时间。提到的代码无济于事
- node.js - 上传文件时nodejs app engine app错误413 Request Entity Too Large
- jmeter - 如何在 JMeter 中每个请求正文都有一个唯一的 id 时每秒发送 1 小时的 HTTP 请求数?
- ruby-on-rails - 运行控制台时,RoR、postgresql gemspec 丢失或损坏
- arrays - 从 NSComboBox 获取选定的文本值
- javascript - 是否可以在显示其内容之前加载 url?
- php - 如果未在 laravel 中验证,则在一段时间后从数据库中删除用户