美文网首页
6.5.2Pandas访问csv数据集

6.5.2Pandas访问csv数据集

作者: 云殊_Tech | 来源:发表于2020-12-13 01:14 被阅读0次
import pandas as pd 
  1. 读取csv数据集文件

    pd.read_csv( filepath/buffer, header, names)

    image-20201212175438743
    • return value: 二维数据表: DataFrame

      image-20201212175735442
    • 设置列标题:

      • header参数

        image-20201212175856131 image-20201212175958852 image-20201212180009685
      • names参数

        image-20201212180454040
  2. 访问数据

    • header()函数

      读取前n行数据
      参数为空时,默认读取二维数据表中的前5行数据

      image-20201212180652830
    • tail()函数: 读取后n行数据

      image-20201212180754746
    • 使用索引和切片

      image-20201212180838971
  3. 显示统计信息

    describe()函数

    image-20201212180931496
  4. DataFrame的常用属性

    • ndim
    • shape
    • size
  5. 转化为ndarray

    • 使用NumPy中的创建数组函数array()

      image-20201212181130203
    • 使用DataFrame中的values属性或as_matrix()方法

    image-20201212181139353

相关文章

网友评论

      本文标题:6.5.2Pandas访问csv数据集

      本文链接:https://www.haomeiwen.com/subject/tqlugktx.html