读取excel文件并绘图

pip install pandas
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple/Note: you may need to restart the kernel to use updated packages.

Requirement already satisfied: pandas in c:\users\zcc\appdata\local\programs\python\python37\lib\site-packages (1.0.3)

WARNING: You are using pip version 20.0.2; however, version 20.1.1 is available.
You should consider upgrading via the 'c:\users\zcc\appdata\local\programs\python\python37\python.exe -m pip install --upgrade pip' command.



Requirement already satisfied: pytz>=2017.2 in c:\users\zcc\appdata\local\programs\python\python37\lib\site-packages (from pandas) (2019.3)
Requirement already satisfied: python-dateutil>=2.6.1 in c:\users\zcc\appdata\local\programs\python\python37\lib\site-packages (from pandas) (2.8.1)
Requirement already satisfied: numpy>=1.13.3 in c:\users\zcc\appdata\local\programs\python\python37\lib\site-packages (from pandas) (1.18.2)
Requirement already satisfied: six>=1.5 in c:\users\zcc\appdata\local\programs\python\python37\lib\site-packages (from python-dateutil>=2.6.1->pandas) (1.14.0)
import pandas as pd
pip install xlrd
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple/Note: you may need to restart the kernel to use updated packages.

Collecting xlrd
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/b0/16/63576a1a001752e34bf8ea62e367997530dc553b689356b9879339cf45a4/xlrd-1.2.0-py2.py3-none-any.whl (103 kB)
Installing collected packages: xlrd
Successfully installed xlrd-1.2.0


WARNING: You are using pip version 20.0.2; however, version 20.1.1 is available.
You should consider upgrading via the 'c:\users\zcc\appdata\local\programs\python\python37\python.exe -m pip install --upgrade pip' command.
pd.read_excel('20200521.xlsx',sheet_name = 'Sheet1')
zhanghexieguohuiairen
0123
1456
2135
excel = pd.read_excel('20200521.xlsx',sheet_name = 'Sheet2')
print(excel)
p1 = excel.plot(kind = 'scatter',x = 'hehe',y = 'lili').get_figure()
p1.savefig('20200521.png')
   hehe  meimei  lili
0    21      31    22
1    45      23    44

在这里插入图片描述

import numpy as np
from pandas import DataFrame
dates = pd.date_range('20200220',periods = 6)
dates
DatetimeIndex(['2020-02-20', '2020-02-21', '2020-02-22', '2020-02-23',
               '2020-02-24', '2020-02-25'],
              dtype='datetime64[ns]', freq='D')
data_frame = DataFrame(np.random.rand(6,4),index = dates,columns = ['lili','vivian','titi','yiyi'])
print(data_frame)
                lili    vivian      titi      yiyi
2020-02-20  0.354546  0.723378  0.163517  0.602189
2020-02-21  0.623336  0.611539  0.979246  0.977655
2020-02-22  0.570643  0.239605  0.401764  0.528233
2020-02-23  0.104641  0.560594  0.553846  0.151324
2020-02-24  0.845639  0.860551  0.371556  0.047637
2020-02-25  0.637819  0.963869  0.748484  0.440282
pd2 = data_frame.plot(kind = 'scatter',x = 'lili', y = 'vivian').get_figure()
pd2.savefig('2020522.png')

在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值