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

Temporal features

As we've seen earlier in the section on data visualization, ridership volume depends heavily on the day of the week, as well as the time of day.

Let's look at the format of the pickup_datetime column by running the following code:

print(df.head()['pickup_datetime'])

We get the following output:

Recall that neural networks require numerical features. Therefore, we can't train our neural network using such a datetime string. Let's separate the pickup_datetime column into different columns for year, month, day, day_of_week, and hour:

df['year'] = df['pickup_datetime'].dt.yeardf['month'] = df['pickup_datetime'].dt.monthdf['day'] ...
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