How to take column-slices of dataframe in pandas
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 选择语言 中文(简体) 日语 英语 中文(繁体) 由 翻译 强力驱动 问题: I load a some machine learning data from a csv file. The first 2 columns are observations and the remaining columns are features. Currently, I do the following : data = pandas . read_csv ( 'mydata.csv' ) which gives something like: data = pandas . DataFrame ( np . random . rand ( 10 , 5 ), columns = list ( 'abcde' )) I'd like to slice this dataframe in two dataframes: one containing the columns a and b and one containing the columns c , d and e . It is not possible to write something like observations =