Data Wrangling in Python – How to Assign A New Column To A Pandas DataFrame

Hits: 8 Assign A New Column To A Pandas DataFrame Preliminaries import pandas as pd Create Dataframe /* Create empty dataframe */ df = pd.DataFrame() /* Create a column */ df[‘name’] = [‘John’, ‘Steve’, ‘Sarah’] /* View dataframe */ df name 0 John 1 Steve 2 Sarah Assign New Column To Dataframe /* Assign a … Continue reading Data Wrangling in Python – How to Assign A New Column To A Pandas DataFrame