Last active
May 6, 2021 19:49
-
-
Save youngsoul/edc1c17333148177c9771502ca7cb933 to your computer and use it in GitHub Desktop.
http://bit.ly/2nFLe2JDataSchool Pandas Video #2reading from url gave some SSL errors, and using requests was able to fix this.This is an example usage on how to get the movieusers
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
| import pandas as pd | |
| from io import StringIO | |
| import requests | |
| requests.packages.urllib3.disable_warnings() | |
| url = 'http://bit.ly/movieusers' | |
| data = requests.get(url=url, verify=False).text | |
| data_reader = StringIO(data) | |
| header_cols = ['user_id', 'age', 'sex', 'occupation', 'zip_code'] | |
| table = pd.read_table(data_reader, sep='|', headers=None, names=header_cols) | |
| table.head(10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment