PART2123

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

PART [A] : SERIES

Question - WAP a program to create a blank series.

Code:

Output:

Question - WAP a program to create a series from list with labels.

Code:

Output:

Question - WAP a program to a create a series from two lists where first list will be values and second
would be indexes.
Code:
Output:

Question - WAP a program to create a series from range() .

Code:

Output:

Question - WAP a program to create a series with Dictionary.

Code:

Output:

Question - WAP a program to create a series with scalar values .


Code:

Output:

Question - WAP a program to create a series from an array.

Code:

Output:

Question - WAP to create a series from the list [1,2,3,4,5,6,7,8,9]


A) Assign indexes as [‘a’,’b’,’c’,’d’,’e’,’f’,’g’,’h’,’i’]
B) Display the indexes ,values ,dimension, shape and size of the series
C) Also display whether series is empty or not

Code:
Output:

Question - WAP a program to display first and last three values of the Series

Code:

 [NOTE : THE SERIES USED HERE IS FROM THE ABOVE CODE IN THE PREVIOUS QUESITON.]
Output:

Question - WAP a program to find the sum ,difference, and product of two series S1 andS2

Code:

Output:
PART [A] : DATAFRAME
WAP a program to create a dataframe from dictionaries

Code:

Output:

WAP a program to create a dataframe from list of dictionaries

Code:

Output:
WAP a program to create a dataframe from array

Code:

Output:

WAP a program to create a dataframe from dictionaries of list

Code:

Output:
Question : Create the following DataFrame Sales containing year wise sales figures for five sales
persons in INR. Use the years as column labels, and sales person names as row labels.

Use the DataFrame created above to do the following:


a. Display the row labels of Sales.
b. Display the column labels of Sales.
c. Display the data types of each column of Sales.
d. Display the dimensions, shape, size and values of Sales.
e. Display the last two rows of Sales.
f. Display the first two columns of Sales.
g. Check if Sales2 is empty or it contains data.
h. Append the DataFrame Sales2 to the DataFrame Sales.
i. Change the DataFrame Sales such that it becomes its transpose.
j. Display the sales made by all sales persons in the year 2017.
k. Display the sales made by Madhu and Ankit in the year 2017 and 2018.
l. Display the sales made by Shruti 2016.
m. Add data to Sales for salesman Sumeet where the sales made are [196.2, 37800, 52000, 78438,
38852] in the years [2014, 2015, 2016, 2017, 2018] respectively.
n. Delete the data for the year 2014 from the DataFrame Sales.
o. Delete the data for sales man Kinshuk from the DataFrame Sales.
p. Change the name of the salesperson Ankit to Vivaan and Madhu to Shailesh.
q. Update the sale made by Shailesh in 2018 to 100000.
r. Write the values of DataFrame Sales to a comma separated file SalesFigures.csv on the disk. Do
not write the row labels and column labels.
s. Read the data in the file SalesFigures.csv into a DataFrame Sales Retrieved and Display it.

Code:

You might also like