In [11]:
import pandas as pd
In [12]:
ufo = pd.read_csv('http://bit.ly/uforeports')
In [13]:
ufo.head()
Out[13]:
In [14]:
ufo.columns
Out[14]:
In [15]:
ufo.rename(columns = {'Colors Reported':'Colors_Reported', 'Shape Reported':'Shape_Reported'}, inplace=True)
In [16]:
ufo.columns
Out[16]:
In [19]:
ufo_cols = ['city', 'colors reported', 'shape reported', 'state', 'time']
In [20]:
ufo.columns = ufo_cols
In [21]:
ufo.head()
Out[21]:
In [26]:
ufo = pd.read_csv('http://bit.ly/uforeports', names=ufo_cols, header=0)
In [27]:
ufo.head()
Out[27]:
In [28]:
ufo.columns
Out[28]:
In [29]:
ufo.columns = ufo.columns.str.replace(' ', '_')
In [30]:
ufo.columns
Out[30]:
In [ ]:
No comments:
Post a Comment