#!/usr/bin/env python # coding: utf-8 # In[43]: import pandas as pd cric = pd.read_html('http://stats.espncricinfo.com/ci/engine/player/348144.html?class=3;template=results;type=batting;view=innings', match='innings', na_values='-') df = cric[0] # In[44]: df.head(10) # In[45]: # Clean up example,eg remove * df['Start Date'] = pd.to_datetime(df['Start Date']) df['Runs'] = df['Runs'].str.extract('(\d+)').astype(int) # In[46]: df.dtypes # In[47]: # Examle take out columns col_choice = df.loc[:, 'Runs':'6s'].head(10) #col_choice.to_csv('out.csv') # In[48]: col_choice.head(10) # In[49]: # If want to fill NaN with 0 df.fillna(0).head(10) # In[50]: df.plot(kind='bar', x='Runs', y='BF') # In[ ]: # In[ ]: