import pandas as pd
# pd.read_csv
# pd.read_json
# pd.ExcelFile
ls
# t = pd.read_csv('https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/significant_month.csv')
t = pd.read_csv('terremotos.csv', parse_dates=['time', 'updated'])
t
len(t)
t[:2]
# t.ix[t.index[0]]
t.iloc[0]
t.to_csv('/tmp/ejemplo.csv', index=False)
cat /tmp/ejemplo.csv
t = t[['time', 'latitude', 'longitude', 'mag', 'depth', 'place']].copy()
t
t[t.mag < 5]
t[(t.mag < 5) & (t.depth < 20)]
t['depth_in_meters'] = t['depth'] * 1000
t
pd.concat([
pd.DataFrame([[1, 2], [3, 4]]),
pd.DataFrame([[5, 6], [7, 8]]),
])
df = pd.DataFrame([
['one', 1.1],
['one', 1.2],
['two', 2.1],
['two', 2.2],
], columns=['name', 'value'])
df
df.groupby('name').sum()
%matplotlib inline
t.plot(kind='scatter', x='mag', y='depth');
Encuentre una tabla en data.gov. Cargelo y guardelo.
pd.read_csv('https://data.cityofnewyork.us/api/views/kku6-nxdu/rows.csv')
Ejemplo: Nombres de niños y niñas
pd.read_csv('https://data.cityofnewyork.us/api/views/25th-nujf/rows.csv')