![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Pandas
怡颜悦色
图象识别方向从事者。
展开
-
第四章 分组
第四章 分组 import numpy as np import pandas as pd 一、分组模式及其对象 df.groupby(分组依据)[数据来源].使用操作 例如第一个例子中的代码就应该如下: df.groupby('Gender')['Longevity'].mean() df = pd.read_csv('../data/learn_pandas.csv') df.groupby('Gender')['Height'].median() Gender Female 159.6原创 2020-12-25 17:09:07 · 302 阅读 · 0 评论 -
第三章 索引
第三章 索引 import numpy as np import pandas as pd 一、索引器 1. 表的列索引 df = pd.read_csv('../data/learn_pandas.csv', usecols = ['School', 'Grade', 'Name', 'Gender', 'Weight', 'Transfer']) df['Name'].head() 0 Gaopeng Yang 1 Changqiang You 2 Mei Sun原创 2020-12-22 12:36:20 · 168 阅读 · 0 评论 -
第二章 pandas基础
第二章 pandas基础 一、文件的读取和写入 1. 文件读取 【a】pandas读取csv, excel, txt文件: import numpy as np import pandas as pd df_csv = pd.read_csv('../data/my_csv.csv') df_csv col1 col2 col3 col4 col5 0 2原创 2020-12-19 09:10:52 · 286 阅读 · 1 评论 -
第一章 预备知识
本文参考了datawhale组队学习相关资料!!! 一、Python基础 1. 列表推导式与条件赋值 函数法生成数字数组: L = [] def my_func(x): return 2*x for i in range(5): L.append(my_func(i)) L [0, 2, 4, 6, 8] 利用列表推导式可进行写法上的简化:[* for i in *]。其中,第一个*为映射函数,其输入为后面i指代的内容,第二个*表示迭代的对象。 [my_func(i) for i in原创 2020-12-15 22:24:16 · 269 阅读 · 0 评论