![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
pandas
轮子去哪儿了
研究生在读:https://github.com/yangzhaonan18
展开
-
pandas 1 基本介绍
pandas 1 基本介绍import numpy as npimport pandas as pdpd.Series() 构造数据s = pd.Series([1, 3, 5, np.nan, 44, 1])print(s)# 0 1.0# 1 3.0# 2 5.0# 3 NaN# 4 44.0# 5 1.0# ...原创 2019-02-26 14:55:00 · 264 阅读 · 0 评论 -
pandas 2 选择数据
pandas 2 选择数据from __future__ import print_functionimport pandas as pdimport numpy as npnp.random.seed(1)dates = pd.date_range('20130101', periods=6)df = pd.DataFrame(np.random.randn(6, 4), in...原创 2019-02-26 14:55:00 · 228 阅读 · 0 评论 -
pandas 6 合并数据 concat, append 垂直合并,数据会变高/长
pandas 6 合并数据 concat, append 垂直合并,数据会变高/长from __future__ import print_functionimport pandas as pdimport numpy as npconcatenating# ignore indexdf1 = pd.DataFrame(np.ones((3,4))*0, columns=['...原创 2019-02-26 14:56:00 · 2427 阅读 · 0 评论 -
pandas 5 导入导出 读取保存 I/O API
pandas 5 导入导出 读取保存 I/O API官网The pandas I/O APIpickle格式是python自带的from __future__ import print_functionimport pandas as pddata = pd.read_csv('student.csv') # 读取数据 read fromprint(data)data....原创 2019-02-26 14:55:00 · 128 阅读 · 0 评论 -
pandas 4 处理缺失数据nan
pandas 4 处理缺失数据nanfrom __future__ import print_functionimport pandas as pdimport numpy as npnp.random.seed(1)dates = pd.date_range('20130101', periods=6)df = pd.DataFrame(np.arange(24).reshap...原创 2019-02-26 14:55:00 · 424 阅读 · 0 评论 -
pandas 3 设置值
pandas 3 设置值from __future__ import print_functionimport pandas as pdimport numpy as npnp.random.seed(1)dates = pd.date_range('20130101', periods=6)df = pd.DataFrame(np.random.randn(6,4), inde...原创 2019-02-26 14:55:00 · 169 阅读 · 0 评论 -
pandas 7 合并 merge 水平合并,数据会变宽
pandas 7 合并 merge 水平合并,数据会变宽pd.merge( df1, df2, on=['key1', 'key2'], left_index=True, right_index=True, how=['left', 'right', 'outer', 'inner'], indicator='indicator_column', suffixes=['_boy', '_gir...原创 2019-02-26 14:29:00 · 529 阅读 · 0 评论 -
pandas 8 画图
pandas 8 画图from __future__ import print_functionimport pandas as pdimport numpy as npimport matplotlib.pyplot as plt# plot dataSeries 构造1列数据,data.plot()# Series 构造1列数据np.random.seed(1)d...原创 2019-02-26 14:55:00 · 174 阅读 · 0 评论