【Python】pandas的read_csv参数简略概括(header,path),DataFrame的返回值describe,plot,head

在看吴恩达老师的机器学习时,想用python来实现,网上一搜发现了教程,发现以下函数不太懂,于是写博客来记录下:

 

 

1.read_csv函数

这个函数的参数特别多,我只说我用到的。。

以这个为例【Python】pandas的read_csv参数简略概括(header,path),DataFrame的返回值describe,plot,head

1.路径:这个没的说,打开文件要写位置,我一般写的绝对路径,记得斜杠要写成'/'

2.header,官方机器翻译的跟屎一样,大概意思是这样的


(1)header=None

即指明原始文件数据没有列索引,这样read_csv为自动加上列索引,除非你给定列索引的名字。用name

【Python】pandas的read_csv参数简略概括(header,path),DataFrame的返回值describe,plot,head

【Python】pandas的read_csv参数简略概括(header,path),DataFrame的返回值describe,plot,head


所以说不推荐在有列标题的情况下用第一种写法

(2)header=0

表示文件第0行(即第一行,索引从0开始)为列索引,这样加names会替换原来的列索引。

【Python】pandas的read_csv参数简略概括(header,path),DataFrame的返回值describe,plot,head【Python】pandas的read_csv参数简略概括(header,path),DataFrame的返回值describe,plot,head

暂时写这么多,以后用到了再来写

2019年3月12日20:06:07

Lucien

 


data的返回值是DataFrame的,还有一个类型,,,我这里就不多说了。以下是用法:

DataFrame.head([N]) 返回前n行。

DataFrame.count

计算非NA / null观察的数量。(不是数字或者为空)

DataFrame.max

对象中的最大值。

DataFrame.min

对象中最小值。

DataFrame.mean

价值的平均值。

DataFrame.std

obersvations的标准偏差。

DataFrame.select_dtypes

DataFrame的子集包含/排除基于其dtype的列。


下面介绍plot(画图的参数)

kind:表示图像的形状

【Python】pandas的read_csv参数简略概括(header,path),DataFrame的返回值describe,plot,head

figsize:画的图的大小尺寸

【Python】pandas的read_csv参数简略概括(header,path),DataFrame的返回值describe,plot,head

x轴,y轴

【Python】pandas的read_csv参数简略概括(header,path),DataFrame的返回值describe,plot,head