Skip to Main Content

Python for Basic Data Analysis

Start your data science journey with Python. Learn practical Python programming skills for basic data manipulation and analysis.

Assigning Data

Pandas also allows for assignment of data through simple call methods. This allows for the creation of new columns and for some changes to the data. We can do this assigning a constant or iterable of variables.

We can make the whole net_sales column to zero through this simple code:

df['net_sales']=0

Video Guides

Activity: Assigning Data

Try obtaining these outputs!

1. Change the entire order_fufilled column to True

2. Create a new column in the data frame which ranks the rows in decreasing order

Answers for Activity: Assigning Data

import pandas as pd
df=pd.read_csv("Retail dataset.csv")

#1. Change the entire order_fufilled column to True
df['order_fufilled']=True
#2. Create a new column in the data frame which ranks the rows in decreasing order
df['new_column']=range(len(df), 0, -1)