In [3]:
import numpy as np

import pandas as pd

from pandas import Series, DataFrame

In [5]:
import webbrowser
website = 'http://en.wikipedia.org/wiki/NFL_win-loss_records'
webbrowser.open(website)


Out[5]:
True

In [6]:
nfl_frame = pd.read_clipboard()

In [7]:
nfl_frame


Out[7]:
Rank Team Won Lost Tied Pct. First NFL Season Total Games Division
0 1 Dallas Cowboys 493 367 6 0.573 1960 866 NFC East
1 2 Green Bay Packers 730 553 37 0.567 1921 1,320 NFC North
2 3 Chicago Bears 744 568 42 0.565 1920 1,354 NFC North
3 4 Miami Dolphins 439 341 4 0.563 1966 784 AFC East

In [8]:
nfl_frame.columns


Out[8]:
Index([u'Rank', u'Team', u'Won', u'Lost', u'Tied', u'Pct.',
       u'First NFL Season', u'Total Games', u'Division'],
      dtype='object')

In [9]:
nfl_frame.Rank


Out[9]:
0    1
1    2
2    3
3    4
Name: Rank, dtype: int64

In [10]:
nfl_frame.Team


Out[10]:
0       Dallas Cowboys
1    Green Bay Packers
2        Chicago Bears
3       Miami Dolphins
Name: Team, dtype: object

In [12]:
nfl_frame['First NFL Season']


Out[12]:
0    1960
1    1921
2    1920
3    1966
Name: First NFL Season, dtype: int64

In [14]:
DataFrame(nfl_frame, columns=['Team', 'First NFL Season', 'Total Games'])


Out[14]:
Team First NFL Season Total Games
0 Dallas Cowboys 1960 866
1 Green Bay Packers 1921 1,320
2 Chicago Bears 1920 1,354
3 Miami Dolphins 1966 784

In [15]:
nfl_frame.head()


Out[15]:
Rank Team Won Lost Tied Pct. First NFL Season Total Games Division
0 1 Dallas Cowboys 493 367 6 0.573 1960 866 NFC East
1 2 Green Bay Packers 730 553 37 0.567 1921 1,320 NFC North
2 3 Chicago Bears 744 568 42 0.565 1920 1,354 NFC North
3 4 Miami Dolphins 439 341 4 0.563 1966 784 AFC East

In [16]:
nfl_frame.head(2)


Out[16]:
Rank Team Won Lost Tied Pct. First NFL Season Total Games Division
0 1 Dallas Cowboys 493 367 6 0.573 1960 866 NFC East
1 2 Green Bay Packers 730 553 37 0.567 1921 1,320 NFC North

In [17]:
nfl_frame.tail(2)


Out[17]:
Rank Team Won Lost Tied Pct. First NFL Season Total Games Division
2 3 Chicago Bears 744 568 42 0.565 1920 1,354 NFC North
3 4 Miami Dolphins 439 341 4 0.563 1966 784 AFC East

In [19]:
nfl_frame.ix[3]


Out[19]:
Rank                             4
Team                Miami Dolphins
Won                            439
Lost                           341
Tied                             4
Pct.                         0.563
First NFL Season              1966
Total Games                    784
Division                  AFC East
Name: 3, dtype: object

In [20]:
nfl_frame['Stadium'] = 'Levi\'s Stadium'

In [22]:
nfl_frame['Stadium']


Out[22]:
0    Levi's Stadium
1    Levi's Stadium
2    Levi's Stadium
3    Levi's Stadium
Name: Stadium, dtype: object

In [23]:
nfl_frame


Out[23]:
Rank Team Won Lost Tied Pct. First NFL Season Total Games Division Stadium
0 1 Dallas Cowboys 493 367 6 0.573 1960 866 NFC East Levi's Stadium
1 2 Green Bay Packers 730 553 37 0.567 1921 1,320 NFC North Levi's Stadium
2 3 Chicago Bears 744 568 42 0.565 1920 1,354 NFC North Levi's Stadium
3 4 Miami Dolphins 439 341 4 0.563 1966 784 AFC East Levi's Stadium

In [26]:
nfl_frame['Stadium'] = np.arange(4)

In [27]:
nfl_frame


Out[27]:
Rank Team Won Lost Tied Pct. First NFL Season Total Games Division Stadium
0 1 Dallas Cowboys 493 367 6 0.573 1960 866 NFC East 0
1 2 Green Bay Packers 730 553 37 0.567 1921 1,320 NFC North 1
2 3 Chicago Bears 744 568 42 0.565 1920 1,354 NFC North 2
3 4 Miami Dolphins 439 341 4 0.563 1966 784 AFC East 3

In [28]:
del nfl_frame['Stadium']

In [29]:
nfl_frame


Out[29]:
Rank Team Won Lost Tied Pct. First NFL Season Total Games Division
0 1 Dallas Cowboys 493 367 6 0.573 1960 866 NFC East
1 2 Green Bay Packers 730 553 37 0.567 1921 1,320 NFC North
2 3 Chicago Bears 744 568 42 0.565 1920 1,354 NFC North
3 4 Miami Dolphins 439 341 4 0.563 1966 784 AFC East

In [30]:
data = {'City': ['SF', 'LA', 'NYC'], 'Population': [837000,3880000,8400000]}

In [31]:
city_frame = DataFrame(data)

In [32]:
city_frame


Out[32]:
City Population
0 SF 837000
1 LA 3880000
2 NYC 8400000

In [36]:
city_frame


Out[36]:
City Population
0 SF 837000
1 LA 3880000
2 NYC 8400000

In [ ]: