Learn how to discover data types (dtypes) for each column and how to parse time or date data in CSV. You can learn time formats and point to the Pandas documentation about reading CSV files.
- [Instructor] Here the frames are composed of columns. Each column is a series and has its own data type. Or d type. We can look at the data types by accessing the dtype attributes. Let's write d f dot dtypes. You will see that the coordinates are floats, where the time is an object. Which usually means a string in Pandas. In some cases it's okay for data to be a string, but in our case, we expect some time type since these don't have type information embedded in them, unlike JSON for example, which means that everything comes out as a string.
Pandas does a fairly good job at guessing types, but here it needs our help to parse time. There are many ways to write time as a string. Pandas parsers know most of the common formats. If you need to write time as a string, do yourself a favor and use a known format, such as RFC 3339. Also, pick a format without spaces in it and have the year first, so sorting time as a string will work as intended. Let's take a quick look at read csv recommendation. We see there are many options available to use.
One of them is parse dates. Which parses a list of columns to be parsed as time or date. This is also where our initial look at data comes in handy. We know before loading which columns we'd like to parse as time. Let's do this. d f equals p d dot read csv read our file name, and parse dates equal to time. And let's look at the dtypes now.
Now the same column is a 64 bit time stamp in a nanosecond resolution. It might be different on your machine.
- Working with Jupyter notebooks
- Using code cells
- Extensions to the Python language
- Markdown cells
- Editing notebooks
- NumPy basics
- Broadcasting, array operations, and ufuncs
- Folium and Geo
- Machine learning with scikit-learn
- Plotting with matplotlib and bokeh
- Branching into Numba, Cython, deep learning, and NLP
Skill Level Intermediate
NumPy Data Science Essential Trainingwith Charles Kelly3h 54m Intermediate
1. Scientific Python Overview
2. The Jupyter Notebook
3. NumPy Basics
Manage environments5m 11s
6. Folium and Geo
7. NY Taxi Data
10. Other Packages
11. Development Process
Next steps1m 33s
- 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.