Skip to Main Content
It looks like you're using Internet Explorer 11 or older. This website works best with modern browsers such as the latest versions of Chrome, Firefox, Safari, and Edge. If you continue with this browser, you may see unexpected results.

Python for Basic Data Analysis: PD.10 Using Pandas with other functions/mods

Get started on your learning journey towards data science using Python. Equip yourself with practical skills in Python programming for the purpose of basic data manipulation and analysis.

Applying functions and modules

Now that we are familiarized with Panda's basic functionality and syntax, let's explore how we can combine this with other popular mods that are commonly used in python to create more robust data structures appropriate for data analysis. To apply a function to the dataframe, you may simply apply it to the data frame variable as you would apply it on a normal variable. Try out these examples!

1. Applying numpy functions

import numpy as np

2. Applying lambda functions

df['net_sales']=df['net_sales'].apply(lambda x: 1000 * x)

3. Renaming values according to specific values using the map function

d = {False : 'No', True : 'Yes'}
df['order_fufilled'] = df['order_fufilled'].map(d)

4. Renaming values with the replace function

a =  {'Yes':True,'No':False}
df = df.replace({'order_fufilled': a})


Activity: Self-exporation

Pandas works with most other modules and functions as it does with any normal variable in python, do some research and explore what other modules you commonly use can work well with data analysis on data frames with Pandas

Video Guides