In [1]:
import numpy as np
import pandas as pd

from pandas import Series, DataFrame

In [2]:
ser1 = Series(np.arange(3), index=['A', 'B', 'C'])

In [3]:
ser1 = 2 * ser1

ser1


Out[3]:
A    0
B    2
C    4
dtype: int64

In [4]:
ser1['B']


Out[4]:
2

In [6]:
ser1[1]


Out[6]:
2

In [7]:
ser1[0:3]


Out[7]:
A    0
B    2
C    4
dtype: int64

In [8]:
ser1[['A', 'B']]


Out[8]:
A    0
B    2
dtype: int64

In [9]:
ser1[ser1 > 3]


Out[9]:
C    4
dtype: int64

In [11]:
ser1 > 3


Out[11]:
A    False
B    False
C     True
dtype: bool

In [12]:
ser1[ser1 > 3] = 10

In [13]:
ser1


Out[13]:
A     0
B     2
C    10
dtype: int64

In [14]:
dframe = DataFrame(np.arange(25).reshape((5,5)), index=['NYC', 'LA', 'SF', 'DC', 'CHI'], columns = ['A', 'B', 'C', 'D', 'E'])

In [15]:
dframe


Out[15]:
A B C D E
NYC 0 1 2 3 4
LA 5 6 7 8 9
SF 10 11 12 13 14
DC 15 16 17 18 19
CHI 20 21 22 23 24

In [16]:
dframe['B']


Out[16]:
NYC     1
LA      6
SF     11
DC     16
CHI    21
Name: B, dtype: int64

In [17]:
dframe[['A', 'B']]


Out[17]:
A B
NYC 0 1
LA 5 6
SF 10 11
DC 15 16
CHI 20 21

In [18]:
dframe[dframe['C'] > 8]


Out[18]:
A B C D E
SF 10 11 12 13 14
DC 15 16 17 18 19
CHI 20 21 22 23 24

In [19]:
dframe > 10


Out[19]:
A B C D E
NYC False False False False False
LA False False False False False
SF False True True True True
DC True True True True True
CHI True True True True True

In [20]:
dframe.ix['LA']


Out[20]:
A    5
B    6
C    7
D    8
E    9
Name: LA, dtype: int64

In [22]:
dframe.ix[1]


Out[22]:
A    5
B    6
C    7
D    8
E    9
Name: LA, dtype: int64

In [ ]: