Travel Tips
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
使用Python中的matplotlib库读取csv文件绘制各地平均价格和成交量
* Python代码
```python import pandas as pd import matplotlib as mpl import matplotlib.pyplot as plt data = pd.read_csv('taobao_data.csv') data.drop(['宝贝', '卖家'], axis=1, inplace=True) data.set_index('位置', inplace=True) data = data.groupby(['位置']).mean().sort_values('成交量', ascending=False) print(data.head()) mpl.style.use('ggplot') fig, axis = plt.subplots(1, 2) data['价格'].plot(kind='bar', ax=axis[0]) axis[0].set_xlabel('各地平均价格') data['成交量'].plot(kind='barh', ax=axis[1]) axis[1].set_xlabel('各地成交量') plt.show() ```
* 注数据文件链接: https://pan.baidu.com/s/1uXaH_hu4Oyi4QYqHDuXG3g 密码: bfnc
Sed ac lorem felis. Ut in odio lorem. Quisque magna dui, maximus ut commodo sed, vestibulum ac nibh. Aenean a tortor in sem tempus auctor
December 4, 2020 at 3:12 pm
Sed ac lorem felis. Ut in odio lorem. Quisque magna dui, maximus ut commodo sed, vestibulum ac nibh. Aenean a tortor in sem tempus auctor
December 4, 2020 at 3:12 pm
Donec in ullamcorper quam. Aenean vel nibh eu magna gravida fermentum. Praesent eget nisi pulvinar, sollicitudin eros vitae, tristique odio.
December 4, 2020 at 3:12 pm
我是 s enim interduante quis metus. Duis porta ornare nulla ut bibendum
Rosie
6 minutes ago