In [18]:
import numpy as np
import pandas as pd
from IPython.display import display

In [19]:
A = np.arange(20).reshape(4,5)

AA = pd.DataFrame(A)
print(AA)
display(AA)


    0   1   2   3   4
0   0   1   2   3   4
1   5   6   7   8   9
2  10  11  12  13  14
3  15  16  17  18  19
0 1 2 3 4
0 0 1 2 3 4
1 5 6 7 8 9
2 10 11 12 13 14
3 15 16 17 18 19

In [4]:
print(AA.shape)
print(len(AA))


(4, 5)
4

In [9]:
BB = pd.DataFrame(A, index=range(1,5),columns=['a','b','c','d','e'])
print (BB)


    a   b   c   d   e
1   0   1   2   3   4
2   5   6   7   8   9
3  10  11  12  13  14
4  15  16  17  18  19

In [17]:
print(BB.loc[2])


a    5
b    6
c    7
d    8
e    9
Name: 2, dtype: int64

In [13]:
print(BB.loc[:,'a'])


1     0
2     5
3    10
4    15
Name: a, dtype: int64