Pandas > Select columns

Name
Code
Output
dataframe = pandas.DataFrame(numpy.random.randint(0,100,size=(5, 4)), columns=['C1','C2','C3','C4'])
print ("dataframe")
print (dataframe)
print ("dataframe selected columns")
print (dataframe[['C1','C2']])
dataframe
   C1  C2  C3  C4
0  47  34  32  96
1  30  25  73  18
2  61  17  27   9
3  74  23  15  73
4  79  49  42  44
dataframe selected columns
   C1  C2
0  47  34
1  30  25
2  61  17
3  74  23
4  79  49