zoukankan      html  css  js  c++  java
  • 给统计人讲Python(2)_Pandas入门

    #Pandas官方文档:http://pandas.pydata.org/pandas-docs/stable/
    #-*-author Yangami-*-
    import pandas as pd
    import numpy as np

    一、基本类型

    用列表、数组和字典构建series

    lst = list('abcedfg')   # 列表
    arr = np.arange(7)                      # 数组
    # 构建方法
    ser1 = pd.Series(lst)
    ser2 = pd.Series(arr)
    #一维序列series会自动添加索引
    print(ser1)
    print(ser2)
    #构建字典转series
    dic = {'及时雨':'宋江','豹子头':'林冲','花和尚':'鲁智深','浪子':'燕青'}
    ser3 = pd.Series(dic)
    ser3
    dict(zip(lst, arr))
    #用两序列构建字典转series
    mydict = dict(zip(lst, arr))             # 字典
    ser3 = pd.Series(mydict)
    ser3
    #series拥有许多np.array的性质
    ser1_=ser2+1
    print(ser1_)
    ser3.shape

    文件中有给统计人讲Python(2)_Pandas入门有完整代码和实例及其数据

  • 相关阅读:
    form表单提交json格式数据
    docker搭建jenkins
    consul搭建服务注册和
    docker创建mysql镜像
    Swagger入门
    net coer log4+ELK搭建
    log4配置
    netcore autofac依赖注入
    netcore 跨域
    netcore 读取配置文件
  • 原文地址:https://www.cnblogs.com/Yangami/p/10987575.html
Copyright © 2011-2022 走看看