October 2019
Beginner to intermediate
674 pages
16h 43m
English
A new column can be added to a DataFrame by inserting a scalar value into it. Inserting a scalar value into any column of a DataFrame will cause the entire column to be filled with that scalar value:
In [61]: memberDF['Height'] = 60In [62]: memberDF
The following is the output:

Instead of a scalar value, a list of values can also be assigned:
In [63]: memberDF['Height2'] = [57, 62, 65, 59]In [64]: memberDF
The following is the output:

A column can also be inserted at the desired position using the insert method. This needs ...
Read now
Unlock full access