![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
文章平均质量分 71
小雪@
不想学习的小白
展开
-
绘图
import numpy as np import pandas as pdimport matplotlib.pyplot as pltpandas和seaborn绘图折线图s = pd.Series(np.random.randn(10).cumsum(),index=np.arange(0,100,10))s0 0.58175810 0.92784420 4.12197230 3.84921740 2.64339250 1.699543原创 2021-02-10 19:09:31 · 1394 阅读 · 0 评论 -
matplotlib 绘图库
import matplotlib.pyplot as pltimport numpy as npimport pandas as pddata = np.arange(10)dataarray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])plt.plot(data)[<matplotlib.lines.Line2D at 0x226505a9978>]图片与子图使用plt.figure生成一个新的图片fig = plt.figure()原创 2021-02-02 21:35:28 · 448 阅读 · 2 评论 -
Pandas 入门基础
Pandas 基础import pandas as pdpd.__version__'0.23.0'form pandas import Series,DataFrame熟悉常用的工具数据结构:Series和DataFrameSeries一种一维数组型对象,包含值序列。且包含数据标签,称为索引(index)obj = pd.Series([4,7,-5,3])obj0 41 72 -53 3dtype: int64Series:左边为索引,右边原创 2021-02-02 20:45:22 · 162 阅读 · 0 评论 -
NumPy 基础
import numpy as npnp.__version__'1.14.3'ndarray 数组类型array=[1,2,3,4,5,6]array[1, 2, 3, 4, 5, 6]array=np.array([1,2,3,4,5,6])type(array)numpy.ndarrayarray+1array([2, 3, 4, 5, 6, 7])#加法array2=array+arrayarray2array([ 2, 4, 6, 8, 10原创 2021-01-29 21:46:06 · 158 阅读 · 0 评论 -
Python 基础(三)
模块import sys'A test module'__author__ = '小明'def test(): args = sys.argv print(args) if len(args) == 1: print('hello 1') elif len(args) == 2: print('hello 2', args[0], args[1]) else: print('hello', len(args原创 2021-01-28 21:44:50 · 145 阅读 · 0 评论 -
Python 基础(二)
文件的读写读文件f = open('test.txt','r') f.read() '1\n2\n3\n4\n5\n6\n7\n8\n9\n'f.close() # 打开文件时是否出错,都可关闭文件try : f = open('test.txt','r') print(f.read())finally: if f: f.close()123456789# 打开文件写法with open('test.txt'原创 2021-01-28 20:17:10 · 152 阅读 · 0 评论 -
Python 基础(一)
Python入门基础print('Hello,world!')Hello,world!b=[1,2,3]b?Object `b` not found.通过?来显示一些关于该对象的概要信息print?1.单?显示文档字符串2.双??显示源代码%run:在IPython中使用它运行任意的python程序文件%load:导入一个代码单元导入:import xx(.py)二元运算符和比较运算符5-7-212+21.533.55<=2Falseis原创 2021-01-28 15:16:52 · 497 阅读 · 0 评论