目錄 Pandas 官方教程 1.1 十分钟搞定 Pandas 1.2 Pandas 秘籍 1.3 喜一皆 1.3.1 喜一皆 1.3.2 第三章 1.3.3 第四章 1.3.4 第五章 1.3.5 第六章 1.3.6 第七章 1.3.7 第八章 1.3.8 第九章 1.3.9 学习Pandas 1.4 01-Lesson 1.4.1 02-Lesson 1.4.2 03-Lesson 1.4.3 04 - Lesson 1.4.4 05-Lesson 1.4.5 06 - Lesson 1.4.6 07-Lesson 1.4.7 08-Lesson 1.4.8 09-Lesson 1.4.9 10-Lesson 1.4.10 11 - Lesson 1.4.11
Pandas官方教程 Pandas官方教程 官方教程是官方文档的教程页面上的教程.
名称 原文 译者 十分钟搞定pandas 10Minutestopandas ChaoSimple Pandas秘籍 Pandas cookbook 飞龙 学习Pandas Learn Pandas 派兰数据 在线阅读 PDF格式 EPUB格式 MOBI格式 代码仓库 2
十分钟搞定Pandas 十分钟搞定pandas 原文:10Minutes topandas 译者:ChaoSimple 来源:【原】十分钟搞定pandas 官方网站上《10Minutes topandas》的一个简单的翻译,原文在这里.
这篇文章 是对pandas的一个简单的介绍,详细的介绍请参考:秘籍.
习惯上,我们会按下 面格式引入所需要的包: In[1]:import pandas as pd In[2]:importnumpy as np In[3]:import matplotlib.pyplot as plt 一、创建对象 可以通过数据结构入门来查看有关该节内容的详细信息.
1、可以通过传递一个list对象来创建一个Series,pandas会默认创建整型 索引: In [4]:s=pd.Series([1 3 5 np.nan 6 8]) In[5]:s Out[5]: 0 1.0 1 3.0 2 5.0 3 NaN 4 6.0 5 8.0 dtype:float64 3
十分钟搞定Pandas 个DataFrame: In [6]:dates =pd.date_range('20130101' periods=6) In [7]:dates Out[7]: DatetimeIndex(['2013-01-01' '2013-01-02' '2013-01-03' '2013-0 1-04' 2013-01-05′ '2013-01-06'] dtype='datetime64[ns]' freq='D') In [8]:df=pd.DataFrame(np.random.randn(6 4) index=dates col umns=list('ABCD')) In[9]:df out[9]: A B C D 2013-01-01 0.469112 -0.282863 -1.509059 -1.135632 2013-01-02 1.212112 -0.173215 0.119209 -1.044236 2013-01-03-0.861849 -2.104569 -0.494929 1.071804 2013-01-04 0.721555 -0.706771 -1.039575 0.271860 2013-01-05-0.424972 0.567020 0.276232 -1.087401 2013-01-06 -0.673690 0.113648 -1.478427 0.524988 3、通过传递一个能够被转换成类似序列结构的字典对象来创建一 个DataFrame: 4
十分钟搞定Pandas In[10]:df2=pd.DataFrame({'A':1. 'B': pd.Timestamp('20130102') 'C:pd.Series(1 index=list(range( 4)) dtype='float32') 'D':np.array([3]*4 dtype='int3 2') 'E':pd.Categorical(["test" "trai n","test","train"]) F’:foo}) In[11]:df2 Out[11]: A B C D E F 1.0 2013-01-02 1.0 3 test foo 1 1.0 2013-01-02 1.0 3 train foo 2 1.0 2013-01-02 1.0 3 test foo 3 1.0 2013-01-02 1.0 3 train foo D 4、查看不同列的数据类型: In [12]:df2.dtypes out[12]: A float64 B datetime64[ns] C float32 D int32 E category F object dtype:object 5、如果你使用的是IPython,使用Tab自动补全功能会自动识别的属性以及自 定义的列,下图中是能够被自动识别的属性的一个子集: 5