Pandas get column data bits common functions, but there are some things to note in the wording, here to summarize:
' author:zilu.tang2015-12-31 ' ' import pandas as Pddata1 = PD. DataFrame (...) #任意初始化一个列数为3的DataFramedata1. columns=[' A ', ' B ', ' C ']1.data1[' B '] #这里取到第2列 (i.e. column B), the value of the 2.data1.b# effect is the same as 1, Take the 2nd column (that is, column B) #这里b为列名称, but must be a contiguous string and cannot have spaces. If there are spaces listed, you can only take the 1th method 3.data1[data1.columns[1:]] #这里取data1的第2列和第3列的所有数据番外1. data1[5:10] #这里取6到11行的所有数据 instead of column data 2.data _RAW_BY_TICK[2] #非法, return to "Keyerror:2"
This article is from the "Full Stack blog" blog, be sure to keep this source http://reboot001.blog.51cto.com/10869138/1730256
Python pandas several methods for obtaining column data and comparison of writing forms