You are on page 1of 2

Pandas Assignment-5

1 - List-to-Series Conversion
Given a list [2, 4, 5, 6, 9], output the corresponding pandas series and output the corresponding
pandas series with odd indexes only. Apply the function, f(x) = x/2 on each and every element of a given
pandas series

2 - Date Series Generation


Generate the series of dates from 1st May, 2021 to 12th May, 2021 (both inclusive)

3 - Dictionary-to-Dataframe Conversion
Given a dictionary, convert it into corresponding dataframe and display it

dictionary = {'name': ['Vinay', 'Kushal', 'Aman'],


'age' : [22, 25, 24],
'occ' : ['engineer', 'doctor', 'accountant']}

4 - 2D List-to-Dataframe Conversion
Given a 2D List, convert it into corresponding dataframe and display it, store data in
CSV file, read it into a dataframe and display it, change the index of a dataframe from
the default indexes to a particular column

Given list:
lists = [[2, 'Vishal', 22],
[1, 'Kushal', 25],
[1, 'Aman', 24]]

5 - Sorting a Dataframe by Index


Refer earlier dataframe (say, with custom indexing), sort it by it's index.

6 - Sorting a Dataframe by Multiple Columns


Refer earlier dataframe, sort it by multiple columns.

7 - DataFrame with Custom Index to DataFrame with


Dataframe with default indexes
Refer earlier dataframe with custom indexing, convert and it to default indexing and
display it select a particular column and display it.
8 - Indexing and Selecting Rows in a DataFrame
Given a dataframe, select first 2 rows and output them

9 - Conditional Selection of Rows in a DataFrame


Refer earlier dataframe, select rows based on a condition

10 - Applying Aggregate Functions


Given is a dataframe showing name, occupation, salary, experience of people. Find the
average salary per occupation, Given a dataframe with NaN Values, fill the NaN values
with 0

name occ salary experience


0 Vinay engineer 60000 10
1 Kushal doctor 70000 NaN
2 Aman engineer 50000 7
3 Rahul doctor 60000 NaN
4 Ramesh doctor 65000 9

You might also like