Join Michele Vallisneri for an in-depth discussion in this video Loading datasets, part of Introduction to Data Analysis with Python.
- [Voiceover] We start by loading the Baby Name dataset.…In the process of doing that,…we learn how to uncompress a zip archive,…how to use Python to list the contents of a directory.…how to load a comma-separated file into Pandas,…and how to concatenate DataFrames.…Let's go open the IPython notebook.…Let's select the 07_02_loading_begin exercise file.…We start by loading a view basic Python packages.…Numpy, matplotlib_pyplot,…Pandas of course, and seaborn.…
We instruct the IPython notebook…to keep all plots inline.…The Social Security data…are available on multiple government websites,…but I've also included them in the names.zip file…in the exercise file directory.…We need to uncompress that archive.…We can do that with the Python zipfile module.…So we import that,…we create a zipfile object from the names.zip file…and we extract its contents…into the current directory.…
That's just a dot.…We'll use Python to look at the contents…of the directory names.…For that, we load the os module…and use the listdir function.…
- Writing and running Python in iPython
- Using Python lists and dictionaries
- Creating NumPy arrays
- Indexing and slicing in NumPy
- Downloading and parsing data files into NumPy and Pandas
- Using multilevel series in Pandas
- Aggregating data in Pandas
Skill Level Intermediate
Q: The course shows how to download files from FTP and web servers using Python 3.X. How do I do the same thing with Python 2.7?
A: First import urllib, then use urllib.urlretrieve(URL,filename). For instance, to download the stations.txt files used in the chapter 5 video “Downloading and parsing data files,” you’d do urllib.urlretrieve(‘ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/daily/ghcnd-stations.txt','stations.txt').
1. Installation and Setup
2. Refresher: Data Containers in Python
3. Word Anagrams in Python
4. Introduction to NumPy
5. Weather Data with NumPy
6. Introduction to Pandas
7. Baby Names with Pandas
Next steps1m 36s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.