前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >numpy介绍

numpy介绍

作者头像
用户7267083
发布2022-12-08 14:13:33
3270
发布2022-12-08 14:13:33
举报
文章被收录于专栏:sukuna的博客sukuna的博客

数值分析复习

于2021年11月23日2021年11月23日由Sukuna发布

一些基本介绍

Jupyter是一个可以在网页上运行Python代码的一个平台

现在介绍一下Jupyter的使用方法: 如你所见,Jupyter有许多个cell组成,有代码块,和markdown块.代码块里面有In[]和Out[]

In [1]:

代码语言:javascript
复制
#Use %timeit来计算时间
%timeit L = [n ** 2 for n in range(1000)]
代码语言:javascript
复制
268 µs ± 8.03 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)

In [2]:

代码语言:javascript
复制
#展示操作
%history -n 1-4
代码语言:javascript
复制
   1:
#Use %timeit来计算时间
%timeit L = [n ** 2 for n in range(1000)]
   2:
#展示操作
%history -n 1-4

In [ ]:

代码语言:javascript
复制
#To run
%run myscript.py
#run myscript.py and output results in the current cell
#• To load/import
%load myscript.py
#load "import" myscript.py into the current cell
#• To write/save
%%writefile myfile.py.

In [3]:

代码语言:javascript
复制
#可以调用Shell语句
contents = !ls
print(contents)
message = "hello from Python"
!echo {message}
代码语言:javascript
复制
['$RECYCLE.BIN', '2020.夏学习', '2020秋学习', '2021 春学习', '2021冬学习', 'E5A92AD8-ADB5-4A77-A9FE-57B8F8D43B51.png', 'TOFEL', 'Thumbs.db', 'U201913821+朱旭鹏汇编语言实验报告.pdf', 'Windows', 'abab.html', 'abab.ipynb', 'desktop.ini', 'exp.', 'midi合集', 'myfile.py.', 'svn', '书', '第11-13章基础练习题(修订版).docx', '汇编', '结果.pdf', '杂七杂八', '题目设计.docx', '阿巴阿巴.md', '每日计划.xlsx', '汇编语言实验报告.docx', '汇编语言实验报告.pdf']
hello from Python

In [4]:

代码语言:javascript
复制
def func1(a, b):
    return a / b
def func2(x):
    a = x
    b = x - 1
    return func1(a, b)

In [5]:

代码语言:javascript
复制
%debug func2(1)
#运行会产生ipdb>
#输入语句可以产生效果
代码语言:javascript
复制
NOTE: Enter 'c' at the ipdb>  prompt to continue execution.
> <string>(1)<module>()

ipdb> up
> /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/bdb.py(587)run()
    585         sys.settrace(self.trace_dispatch)
    586         try:
--> 587             exec(cmd, globals, locals)
    588         except BdbQuit:
    589             pass

ipdb> print(a)
*** NameError: name 'a' is not defined
ipdb> exit
下面对于numpy的操作进行一些介绍

In [6]:

代码语言:javascript
复制
print("hello")
代码语言:javascript
复制
hello

In [7]:

代码语言:javascript
复制
%%writefile myfile.py.
print("hello")
代码语言:javascript
复制
Overwriting myfile.py.

In [8]:

代码语言:javascript
复制
#Python自带的List
L=[1,2,3,4,5]
print(L)
代码语言:javascript
复制
[1, 2, 3, 4, 5]

In [9]:

代码语言:javascript
复制
import numpy as np

In [18]:

代码语言:javascript
复制
#一些声明的方法
#二维声明
a = np.array([[1,  2],  [3,  4]])  
print (a)
# dtype 参数  
a = np.array([1,  2,  3], dtype = complex)  
print (a)
代码语言:javascript
复制
[[1 2]
 [3 4]]
[1.+0.j 2.+0.j 3.+0.j]

In [19]:

代码语言:javascript
复制
#定义数据结构并且声明数组
dt = np.dtype([('age',np.int8)]) 
a = np.array([(10,),(20,),(30,)], dtype = dt)
#限制输出的元素
print(a['age'])
student = np.dtype([('name','S20'), ('age', 'i1'), ('marks', 'f4')]) 
a = np.array([('abc', 21, 50),('xyz', 18, 75)], dtype = student) 
print(a)
代码语言:javascript
复制
[10 20 30]
[(b'abc', 21, 50.) (b'xyz', 18, 75.)]

In [11]:

代码语言:javascript
复制
#全部填充0
b=np.zeros(10, dtype=int)
print(b)
#全部填充1
b=np.ones((3, 5), dtype=float)
print(b)
#全部填充某个值
b=np.full((3, 5), 3.14)
print(b)
#每步跳2
b=np.arange(0, 20, 2)
print(b)
#一共走n步
b=np.linspace(0, 1, 5)
print(b)
代码语言:javascript
复制
[0 0 0 0 0 0 0 0 0 0]
[[1. 1. 1. 1. 1.]
 [1. 1. 1. 1. 1.]
 [1. 1. 1. 1. 1.]]
[[3.14 3.14 3.14 3.14 3.14]
 [3.14 3.14 3.14 3.14 3.14]
 [3.14 3.14 3.14 3.14 3.14]]
[ 0  2  4  6  8 10 12 14 16 18]
[0.   0.25 0.5  0.75 1.  ]

In [12]:

代码语言:javascript
复制
#ramdom函数:生成随机数
np.random.random((3, 3))

Out[12]:

代码语言:javascript
复制
array([[0.61499486, 0.51899507, 0.79505671],
       [0.81141113, 0.4516106 , 0.65727601],
       [0.89103435, 0.93678756, 0.2953434 ]])

In [13]:

代码语言:javascript
复制
#取值
np.random.normal(0,1, (3, 3))

Out[13]:

代码语言:javascript
复制
array([[ 0.36907848,  1.28557422,  0.28982773],
       [ 0.70328736,  0.68839499, -0.15777985],
       [ 0.82233816, -2.18052732, -0.27150497]])

In [22]:

代码语言:javascript
复制
#随机取整数值
np.random.seed(0)
x1 = np.random.randint(10, size=6) # One-dimensional array
x2 = np.random.randint(10, size=(3, 4)) # Two-dimensional array
x3 = np.random.randint(10, size=(3, 4, 5)) # Three-dimensional arra
print(x2)
#可以取n:m的值,n默认为0,m默认为最大值
x2_sub = x2[:2, :2]
x2_sub2 = x2[2: ,2:]
#可以像n维数组那样取值
x2_sub[0, 0] = 99
print(x2_sub)
print(x2_sub2)
a = np.array([[1,2,3],[3,4,5],[4,5,6]])  
print (a[...,1])   # 第2列元素
print (a[1,...])   # 第2行元素
print (a[...,1:])  # 第2列及剩下的所有元素
代码语言:javascript
复制
[[3 5 2 4]
 [7 6 8 8]
 [1 6 7 7]]
[[99  5]
 [ 7  6]]
[[7 7]]
[2 4 5]
[3 4 5]
[[2 3]
 [4 5]
 [5 6]]

In [16]:

代码语言:javascript
复制
#这个是引用的,类似于C的数组
print(x2)
代码语言:javascript
复制
[[99  5  2  4]
 [ 7  6  8  8]
 [ 1  6  7  7]]

In [17]:

代码语言:javascript
复制
#深拷贝
x2_copy = x2[:2, :2].copy()
x2_copy[0, 0] = 9999
print(x2_copy)
print(x2)
代码语言:javascript
复制
[[9999    5]
 [   7    6]]
[[99  5  2  4]
 [ 7  6  8  8]
 [ 1  6  7  7]]

In [20]:

代码语言:javascript
复制
#reshape可以改变维度
a = np.arange(24)  
print (a.ndim)             # a 现只有一个维度
# 现在调整其大小
b = a.reshape(2,4,3)  # b 现在拥有三个维度
print (b.ndim)
# 当然可以通过shape来改变(reshape是个方法,shape是个成员)
a = np.array([[1,2,3],[4,5,6]]) 
a.shape =  (3,2)  
print (a)
代码语言:javascript
复制
1
3
[[1 2]
 [3 4]
 [5 6]]

In [21]:

代码语言:javascript
复制
#可以通过已有数组来构建narray
x =  [1,2,3] 
a = np.asarray(x)  
print (a)
x =  [(1,2,3),(4,5)] 
a = np.asarray(x)  
print (a)
代码语言:javascript
复制
[1 2 3]
[(1, 2, 3) (4, 5)]

In [ ]:

代码语言:javascript
复制
a = np.arange(10)
s = slice(2,7,2)   # 从索引 2 开始到索引 7 停止,间隔为2
print (a[s])
b = a[2:7:2]   # 从索引 2 开始到索引 7 停止,间隔为 2
print(b)

In [24]:

代码语言:javascript
复制
grid = np.arange(1, 10).reshape((3, 3))
print(grid)
代码语言:javascript
复制
[[1 2 3]
 [4 5 6]
 [7 8 9]]

In [26]:

代码语言:javascript
复制
#转置
x=np.array(range(1,10)).reshape((3,3))
print(x.T)
x=np.arange(10)
print(x.T)
#布尔索引
print  ('大于 5 的元素是:')
print (x[x >  5])
代码语言:javascript
复制
[[1 4 7]
 [2 5 8]
 [3 6 9]]
[0 1 2 3 4 5 6 7 8 9]
大于 5 的元素是:
[6 7 8 9]

In [27]:

代码语言:javascript
复制
x=np.arange(32).reshape((8,4))
print (x)
print (x[np.ix_([1,5,7,2],[0,3,1,2])])#选择行,选择列
代码语言:javascript
复制
[[ 0  1  2  3]
 [ 4  5  6  7]
 [ 8  9 10 11]
 [12 13 14 15]
 [16 17 18 19]
 [20 21 22 23]
 [24 25 26 27]
 [28 29 30 31]]
[[ 4  7  5  6]
 [20 23 21 22]
 [28 31 29 30]
 [ 8 11  9 10]]

In [28]:

代码语言:javascript
复制
#广播
a = np.array([[ 0, 0, 0],
           [10,10,10],
           [20,20,20],
           [30,30,30]])
b = np.array([1,2,3])
print(a + b)
代码语言:javascript
复制
[[ 1  2  3]
 [11 12 13]
 [21 22 23]
 [31 32 33]]

In [27]:

代码语言:javascript
复制
grid = np.array([[1, 2, 3],
[4, 5, 6]])
np.concatenate([grid, grid])
np.concatenate([grid, grid], axis= 1)

Out[27]:

代码语言:javascript
复制
array([[1, 2, 3, 1, 2, 3],
       [4, 5, 6, 4, 5, 6]])

In [29]:

代码语言:javascript
复制
def compute_reciprocals(values):
    output = np.empty(len(values))
    for i in range(len(values)):
        output[i] = 1.0 / values[i]
    return output
values = np.random.randint(1, 10, size=5)
compute_reciprocals(values)

Out[29]:

代码语言:javascript
复制
array([0.2       , 0.25      , 0.2       , 0.2       , 0.11111111])

In [31]:

代码语言:javascript
复制
big_array = np.random.randint(1, 100, size=1000000)
%timeit compute_reciprocals(big_array)
%timeit (1.0 / big_array)
代码语言:javascript
复制
1.97 s ± 37.6 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
2.95 ms ± 63.9 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

In [33]:

代码语言:javascript
复制
M = np.random.random((3, 4))
print(M)
M.sum()
a=M.min(axis=0)
print(a)
a=M.max(axis=1) 
print(a)
代码语言:javascript
复制
[[0.35944446 0.48089353 0.68866118 0.88047589]
 [0.91823547 0.21682214 0.56518887 0.86510256]
 [0.50896896 0.91672295 0.92115761 0.08311249]]
[0.35944446 0.21682214 0.56518887 0.08311249]
[0.88047589 0.91823547 0.92115761]

一些数学函数和字符串函数就暂时不说,可以查询API

pandas的一些操作

In [35]:

代码语言:javascript
复制
#传统的关于字典的操作
datatable = [{'temp':28, 'humidity':80},
            {'temp':26, 'humidity':75},
            {'temp':32, 'humidity':50},
            {'temp':30, 'humidity':65},
            {'temp':33, 'humidity':55}]
#遍历元素
for i in range(0, len(datatable)):
    for j in datatable[i]:
        print('Row {} Cell {}: {}'.format(i, j, datatable[i][j]))
columns = []
columns.append([])
columns.append([])

for i in range(0, len(datatable)):
    columns[0].append(datatable[i]['temp'])
    columns[1].append(datatable[i]['humidity'])
#遍历列
for i in range(0, len(columns)):
    print('Column {}: {}'.format(i, columns[i]))
代码语言:javascript
复制
Row 0 Cell temp: 28
Row 0 Cell humidity: 80
Row 1 Cell temp: 26
Row 1 Cell humidity: 75
Row 2 Cell temp: 32
Row 2 Cell humidity: 50
Row 3 Cell temp: 30
Row 3 Cell humidity: 65
Row 4 Cell temp: 33
Row 4 Cell humidity: 55
Column 0: [28, 26, 32, 30, 33]
Column 1: [80, 75, 50, 65, 55]

In [43]:

代码语言:javascript
复制
datatable2 = [{'temp':28, 'humidity':80},
            {'temp':26, 'humidity':75},
            {'temp':32, 'humidity':50},
            {'temp':30, 'humidity':65},
            {'temp':33, 'humidity':55}]
averages = []

for i in range(0, len(datatable1)):
    averages.append((datatable1[i]['temp'] + datatable2[i]['temp']) / 2)
for i in range(0, len(datatable1)):
    print('Average for Row {}: {}'.format(i, averages[i]))
代码语言:javascript
复制
Average for Row 0: 28.0
Average for Row 1: 26.0
Average for Row 2: 32.0
Average for Row 3: 30.0
Average for Row 4: 33.0

In [50]:

代码语言:javascript
复制
#声明一个Series
!pip install pandas
import numpy as np
import pandas as pd
#index默认为从0开始的
s = pd.Series([12, -4, 7, 9])
print(s)
代码语言:javascript
复制
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting pandas
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/d6/66/35235bc1d1ebc34d807c100c4b54a13660695f18c2fb29d2192ebbb5a613/pandas-1.2.4-cp38-cp38-macosx_10_9_x86_64.whl (10.5 MB)
     |████████████████████████████████| 10.5 MB 1.3 MB/s eta 0:00:01
Requirement already satisfied: python-dateutil>=2.7.3 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from pandas) (2.8.1)
Collecting pytz>=2017.3
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/70/94/784178ca5dd892a98f113cdd923372024dc04b8d40abe77ca76b5fb90ca6/pytz-2021.1-py2.py3-none-any.whl (510 kB)
     |████████████████████████████████| 510 kB 3.4 MB/s eta 0:00:01
Requirement already satisfied: numpy>=1.16.5 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from pandas) (1.18.2)
Requirement already satisfied: six>=1.5 in /Users/xupengzhu/Library/Python/3.8/lib/python/site-packages (from python-dateutil>=2.7.3->pandas) (1.14.0)
Installing collected packages: pytz, pandas
Successfully installed pandas-1.2.4 pytz-2021.1
WARNING: You are using pip version 21.0.1; however, version 21.1.1 is available.
You should consider upgrading via the '/Library/Frameworks/Python.framework/Versions/3.8/bin/python3 -m pip install --upgrade pip' command.
0    12
1    -4
2     7
3     9
dtype: int64

In [51]:

代码语言:javascript
复制
s = pd.Series([12, -4, 7, 9], index=['a', 'b', 'c', 'd'])
print(s)
# Selecting elements
print(s[2])#第二个
print(s['b'])
print(s[0:2])
print(s[['b','c']])
#赋值
s[1] = 0
print(s)
# 布尔索引
print(s[s>8])
# Operations and math functions
print(s/2)
代码语言:javascript
复制
a    12
b    -4
c     7
d     9
dtype: int64
7
-4
a    12
b    -4
dtype: int64
b   -4
c    7
dtype: int64
a    12
b     0
c     7
d     9
dtype: int64
a    12
d     9
dtype: int64
a    6.0
b    0.0
c    3.5
d    4.5
dtype: float64

In [53]:

代码语言:javascript
复制
serd = pd.Series([1,0,2,1,2,3], index=['white','white','blue','green','green','yellow'])
print(serd)

print(serd.unique())
print(serd.value_counts())
#在里面么?不再的话就是True
print(serd.isin([0,3]))
print(serd[serd.isin([0,3])])
代码语言:javascript
复制
white     1
white     0
blue      2
green     1
green     2
yellow    3
dtype: int64
[1 0 2 3]
1    2
2    2
0    1
3    1
dtype: int64
white     False
white      True
blue      False
green     False
green     False
yellow     True
dtype: bool
white     0
yellow    3
dtype: int64

In [54]:

代码语言:javascript
复制
#根据字典赋值
mydict1 = {'red':2000, 'blue': 1000, 'yellow':500, 'orange':1000}
myseries1 = pd.Series(mydict1)
print(myseries1)
mydict2 = {'red':400, 'yellow':1000, 'black':700}
myseries2 = pd.Series(mydict2)
print(myseries2)
#如果一个没有一个有.默认为NaN
myseries3 = myseries1 + myseries2
print(myseries3)
代码语言:javascript
复制
red       2000
blue      1000
yellow     500
orange    1000
dtype: int64
red        400
yellow    1000
black      700
dtype: int64
black        NaN
blue         NaN
orange       NaN
red       2400.0
yellow    1500.0
dtype: float64

In [63]:

代码语言:javascript
复制
#构建dataFrame
data = {'color': ['blue','green','yellow','red','white'],
        'object': ['ball','pen','pencil','paper','mug'],
        'price':[1.2,1.0,0.6,0.9,1.7]}

print(data)
frame = pd.DataFrame(data)
print(frame)
#有什么行
print(frame.columns)
#有什么列
print(frame.index)
#把值按照矩阵的形式输出
print(frame.values)
#只输出某一列
print(frame['price'])
print(frame.price)
#输出某一行
print(frame.iloc[0])
#某一行某一列元素
print(frame.iloc[0]['price'])
#可以改变元素的值
#另外一个方法寻找
for i in range(0, len(frame.index)):
    frame.loc[i,'price'] = 8.88

print(frame.price)
代码语言:javascript
复制
{'color': ['blue', 'green', 'yellow', 'red', 'white'], 'object': ['ball', 'pen', 'pencil', 'paper', 'mug'], 'price': [1.2, 1.0, 0.6, 0.9, 1.7]}
    color  object  price
0    blue    ball    1.2
1   green     pen    1.0
2  yellow  pencil    0.6
3     red   paper    0.9
4   white     mug    1.7
Index(['color', 'object', 'price'], dtype='object')
RangeIndex(start=0, stop=5, step=1)
[['blue' 'ball' 1.2]
 ['green' 'pen' 1.0]
 ['yellow' 'pencil' 0.6]
 ['red' 'paper' 0.9]
 ['white' 'mug' 1.7]]
0    1.2
1    1.0
2    0.6
3    0.9
4    1.7
Name: price, dtype: float64
0    1.2
1    1.0
2    0.6
3    0.9
4    1.7
Name: price, dtype: float64
color     blue
object    ball
price      1.2
Name: 0, dtype: object
1.2
0    8.88
1    8.88
2    8.88
3    8.88
4    8.88
Name: price, dtype: float64

In [65]:

代码语言:javascript
复制
#利用字典加上一个index数组构造dataFrame
data1 = {'ball': [0,4,8,12],
        'pen': [1,5,9,13],
        'pencil': [2,6,10,14],
        'paper':[3,7,11,15]}

frame1 = pd.DataFrame(data1, index=['red','blue','yellow','white'])

print(frame1)
data2 = {'mug': [0,3,6,9],
        'pen': [1,4,7,10],
        'ball': [2,5,8,11]}

frame2 = pd.DataFrame(data2, index=['blue','green','white','yellow'])

print(frame2)
代码语言:javascript
复制
        ball  pen  pencil  paper
red        0    1       2      3
blue       4    5       6      7
yellow     8    9      10     11
white     12   13      14     15
        mug  pen  ball
blue      0    1     2
green     3    4     5
white     6    7     8
yellow    9   10    11

In [66]:

代码语言:javascript
复制
frame3 = frame1.add(frame2)
print(frame3)
#有重复的就是NaN
代码语言:javascript
复制
        ball  mug  paper   pen  pencil
blue     6.0  NaN    NaN   6.0     NaN
green    NaN  NaN    NaN   NaN     NaN
red      NaN  NaN    NaN   NaN     NaN
white   20.0  NaN    NaN  20.0     NaN
yellow  19.0  NaN    NaN  19.0     NaN

In [73]:

代码语言:javascript
复制
print(frame1.sum())
print(frame1.mean())
print(frame1.describe())
代码语言:javascript
复制
ball      24
pen       28
pencil    32
paper     36
dtype: int64
ball      6.0
pen       7.0
pencil    8.0
paper     9.0
dtype: float64
            ball        pen     pencil      paper
count   4.000000   4.000000   4.000000   4.000000
mean    6.000000   7.000000   8.000000   9.000000
std     5.163978   5.163978   5.163978   5.163978
min     0.000000   1.000000   2.000000   3.000000
25%     3.000000   4.000000   5.000000   6.000000
50%     6.000000   7.000000   8.000000   9.000000
75%     9.000000  10.000000  11.000000  12.000000
max    12.000000  13.000000  14.000000  15.000000

In [76]:

代码语言:javascript
复制
#读入csv
csvframe1 = pd.read_csv('/Users/xupengzhu/Desktop/src/data/myCSV_01.csv')
print(csvframe1)
代码语言:javascript
复制
   white  red  blue  green animal
0      1    5     2      3    cat
1      2    7     8      5    dog
2      3    3     6      7  horse
3      2    2     8      3   duck
4      4    4     2      1  mouse

In [77]:

代码语言:javascript
复制
csvframe1 = pd.read_csv('/Users/xupengzhu/Desktop/src/data/myCSV_01.csv',index_col=4)
print(csvframe1)
代码语言:javascript
复制
        white  red  blue  green
animal                         
cat         1    5     2      3
dog         2    7     8      5
horse       3    3     6      7
duck        2    2     8      3
mouse       4    4     2      1

In [83]:

代码语言:javascript
复制
csvframe = pd.read_csv('/Users/xupengzhu/Desktop/src/data/myCSV_01.csv')
csvframe['total'] = csvframe['white'] + csvframe['red'] + csvframe['blue'] + csvframe['green']
csvframe['excess'] = False
#综合利用
for i in range(len(csvframe)):
    if csvframe.loc[i,'total'] > 15:
        csvframe.loc[i,'excess'] = True

print(csvframe)
代码语言:javascript
复制
   white  red  blue  green animal  total  excess
0      1    5     2      3    cat     11   False
1      2    7     8      5    dog     22    True
2      3    3     6      7  horse     19    True
3      2    2     8      3   duck     15   False
4      4    4     2      1  mouse     11   False

In [84]:

代码语言:javascript
复制
#删除元素
csvframe = csvframe.drop('total', axis=1)
csvframe = csvframe.drop(0, axis=0)

print(csvframe)
代码语言:javascript
复制
   white  red  blue  green animal  excess
1      2    7     8      5    dog    True
2      3    3     6      7  horse    True
3      2    2     8      3   duck   False
4      4    4     2      1  mouse   False

In [89]:

代码语言:javascript
复制
! pip install matplotlib
! pip install seaborn 
import matplotlib.pyplot as plt
import seaborn
seaborn.set()
代码语言:javascript
复制
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Requirement already satisfied: matplotlib in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (3.4.2)
Requirement already satisfied: cycler>=0.10 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from matplotlib) (0.10.0)
Requirement already satisfied: numpy>=1.16 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from matplotlib) (1.18.2)
Requirement already satisfied: pyparsing>=2.2.1 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from matplotlib) (2.4.7)
Requirement already satisfied: python-dateutil>=2.7 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from matplotlib) (2.8.1)
Requirement already satisfied: pillow>=6.2.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from matplotlib) (8.2.0)
Requirement already satisfied: kiwisolver>=1.0.1 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from matplotlib) (1.3.1)
Requirement already satisfied: six in /Users/xupengzhu/Library/Python/3.8/lib/python/site-packages (from cycler>=0.10->matplotlib) (1.14.0)
WARNING: You are using pip version 21.0.1; however, version 21.1.1 is available.
You should consider upgrading via the '/Library/Frameworks/Python.framework/Versions/3.8/bin/python3 -m pip install --upgrade pip' command.
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting seaborn
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/68/ad/6c2406ae175f59ec616714e408979b674fe27b9587f79d59a528ddfbcd5b/seaborn-0.11.1-py3-none-any.whl (285 kB)
     |████████████████████████████████| 285 kB 1.6 MB/s eta 0:00:01
Requirement already satisfied: matplotlib>=2.2 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from seaborn) (3.4.2)
Requirement already satisfied: scipy>=1.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from seaborn) (1.4.1)
Requirement already satisfied: pandas>=0.23 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from seaborn) (1.2.4)
Requirement already satisfied: numpy>=1.15 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from seaborn) (1.18.2)
Requirement already satisfied: kiwisolver>=1.0.1 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from matplotlib>=2.2->seaborn) (1.3.1)
Requirement already satisfied: pyparsing>=2.2.1 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from matplotlib>=2.2->seaborn) (2.4.7)
Requirement already satisfied: pillow>=6.2.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from matplotlib>=2.2->seaborn) (8.2.0)
Requirement already satisfied: python-dateutil>=2.7 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from matplotlib>=2.2->seaborn) (2.8.1)
Requirement already satisfied: cycler>=0.10 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from matplotlib>=2.2->seaborn) (0.10.0)
Requirement already satisfied: six in /Users/xupengzhu/Library/Python/3.8/lib/python/site-packages (from cycler>=0.10->matplotlib>=2.2->seaborn) (1.14.0)
Requirement already satisfied: pytz>=2017.3 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from pandas>=0.23->seaborn) (2021.1)
Installing collected packages: seaborn
Successfully installed seaborn-0.11.1
WARNING: You are using pip version 21.0.1; however, version 21.1.1 is available.
You should consider upgrading via the '/Library/Frameworks/Python.framework/Versions/3.8/bin/python3 -m pip install --upgrade pip' command.

In [90]:

代码语言:javascript
复制
csvframe.plot()

Out[90]:

代码语言:javascript
复制
<AxesSubplot:>

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2021年11月23日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 数值分析复习
    • 一些基本介绍
    领券
    问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档