Skip to Content
Numerical Computing with Python
book

Numerical Computing with Python

by Pratap Dangeti, Allen Yu, Claire Chung, Aldrin Yim
December 2018
Beginner to intermediate
682 pages
18h 1m
English
Packt Publishing
Content preview from Numerical Computing with Python

There's more...

It is possible to recreate the original movie table by joining all the tables back together. First, join the associative tables to the actor/director tables. Then pivot the num column, and add the column prefixes back:

>>> actors = actor_associative.merge(actor_unique, on='actor_id') \                              .drop('actor_id', 1) \                              .pivot_table(index='id',                                            columns='num',                                           aggfunc='first')>>> actors.columns = actors.columns.get_level_values(0) + '_' + \                     actors.columns.get_level_values(1).astype(str)>>> directors = director_associative.merge(director_unique,                                           on='director_id') \                                    .drop('director_id', 1) \                                    .pivot_table(index='id',                                                 columns='num',                                                 aggfunc='first')>>> directors.columns = directors.columns.get_level_values(0) + '_' + \ directors.columns.get_level_values(1) ...
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

Mastering Numerical Computing with NumPy

Mastering Numerical Computing with NumPy

Umit Mert Cakmak, Tiago Antao, Mert Cuhadaroglu

Publisher Resources

ISBN: 9781789953633OtherOtherErrata Page