zoukankan      html  css  js  c++  java
  • pandas_lesson入门

    # encoding=utf-8
    import pandas as pd
    from pylab import mpl
    import matplotlib.pyplot as plt
    from matplotlib import font_manager
    
    #在数据挖掘前一个数据分析、筛选、清理的多功能工具
    
    #将excel读取并转换为pandas的DataFrame
    #pd.read_csv读取CSV文件
    #创建一个默认索引从0开始的Series
    s = pd.Series([1,2,3,4,5,6])
    #创建一个自定义索引的数组,索引由index指定,和前面数组依次对应
    s = pd.Series([1,2,3,4,5,6],index=['a','b','c','d','e','f'])
    #使用字典创建一个DataFrame,字典的Key会自动成为索引,一个Key默认对应一列数据
    df1 = pd.DataFrame({'math':[1,2,3,4,5],'physic':[5,6,7,8,9]})
    #提取头两行,参数指定从开始读取多少行
    df1.head(2)
    #提取结尾数据,参数指定从结尾开始多少行
    df1.tail(2)
    #生成从20180101开始的时间序列,默认增加单位是天
    dates = pd.date_range('20180101',periods=10)
    #创建使用时间索引的Series
    s_date= pd.Series(range(10), index=dates)
    #取出从2018-01-01到2018-01-06的行数据
    s_date['2018-01-01':'2018-01-06']
    
    df_imdb = pd.read_csv('IMDB.csv')
    #查看数据基本信息
    df_imdb.info()
    #选出一列
    df_imdb.Title #相当于df_imdb['Title']
  • 相关阅读:
    MathML
    Redux counterpart rematch dva
    flow
    pauseable 库
    a simple machine learning system demo, for ML study.
    react图工具集成
    SQLite
    Celery
    RabbitMQ installation
    Thunk
  • 原文地址:https://www.cnblogs.com/liangliangzz/p/10279790.html
Copyright © 2011-2022 走看看