Skip to Content
Neural Network Projects with Python
book

Neural Network Projects with Python

by James Loy
February 2019
Beginner to intermediate
308 pages
7h 42m
English
Packt Publishing
Content preview from Neural Network Projects with Python

Ridership by day and hour

Next, let's investigate how the number of rides varies by day and hour.

Recall that the raw data contains a single pickup_datetime column that contains the pickup date and time in datetime format. First, let's separate the pickup year, month, day, day of week, and hour from the original pickup_datetime column into different columns:

df['year'] = df['pickup_datetime'].dt.yeardf['month'] = df['pickup_datetime'].dt.monthdf['day'] = df['pickup_datetime'].dt.daydf['day_of_week'] = df['pickup_datetime'].dt.dayofweekdf['hour'] = df['pickup_datetime'].dt.hour

Since we have previously used the parse_dates parameter when we imported the data into pandas, we can easily identify and separate the year, month, day and hour components ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Machine Learning with Python Cookbook

Machine Learning with Python Cookbook

Chris Albon

Publisher Resources

ISBN: 9781789138900Supplemental Content