Last active
          June 7, 2018 21:16 
        
      - 
      
- 
        Save Kiwibp/5f23e56d74f1fdb2001ae546debbf161 to your computer and use it in GitHub Desktop. 
    NYCDSA DataViz Project -- BeautifulSoup Code Snippet
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | guards_advanced = urllib.request.urlopen("https://rotogrinders.com/pages/nba-advanced-player-stats-guards-181885").read() | |
| guards_advancedguards_ = bs.BeautifulSoup(guards_advanced, 'lxml') | |
| #leaving out a number of lines necessary to extract data, see github repo for full code if you'd like. | |
| guards_advanced_col_names = col_names.split() | |
| print(guards_advanced_col_names) | |
| #could also use pandas read_html method as well | |
| guards_advanced_dfs = pd.read_html("https://rotogrinders.com/pages/nba-advanced-player-stats-guards-181885") | |
| guards_advanced_stats_df = guards_advanced_dfs[2] | |
| guards_advanced_stats_df.tail() | |
| guards_advanced_col_names = pd.Series(guards_advanced_col_names) | |
| print(guards_advanced_col_names) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment