0% found this document useful (0 votes)
4 views18 pages

Record File Answers Python

The document contains a set of programming questions focusing on data manipulation and visualization using Python's Pandas library. It includes tasks such as creating Series and DataFrames, performing calculations, and generating various types of charts and histograms. The questions are structured to guide users through practical applications of Pandas for data analysis and visualization.

Uploaded by

toshaanbanerjee
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views18 pages

Record File Answers Python

The document contains a set of programming questions focusing on data manipulation and visualization using Python's Pandas library. It includes tasks such as creating Series and DataFrames, performing calculations, and generating various types of charts and histograms. The questions are structured to guide users through practical applications of Pandas for data analysis and visualization.

Uploaded by

toshaanbanerjee
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

RECORD FILE QUESTIONNAIRE PART-2(PYTHON)

(15 Progs on Pandas + 5 Progs on Data Visualization)

Q1. Write a program to create two Series Object, one from a dictionary and one from a
numpy array.
Q2. Write a program to generate a series of float numbers from 41.0 to 60.0 with an
increment of 2.5 each.

Q3. Given the following data frame, locate the three largest ‘Age’ values.

Q4. Create a dataframe for examination result and display the row labels, column labels,
data types of each column and the dimension of the dataframe.
Q5. Consider the above df and answer the following:
(a) Write a command to compute sum of column Age.
(b) Write a command to compute average of last 3 rows of Age column.
Q6. Create a df storing salesmen details (name, zone, sales) of five salesmen.
Q7. Write a program to create a dataframe and display the number of rows and number of
columns in the DataFrame df.
Q8. Write a Pandas program to create and display a DataFrame from a specified dictionary
data along with index labels.
Q9. Write a Pandas program to get the first 3 rows of a given DataFrame df below-

The output should look as follows-

Q10. Write a program to create a Series Object s1 and Sort the values of a Series object s1
in ascending order of its values and store it into series object s2.

Q11. Write a program to create data series and then change the indexes of the Series
object in any random order.

[Link] a program to change the column name ‘Rollno’ to ‘Rno’ of the following df

Rollno Name Marks

SecA 1 Rishi 97

SecB 2 Arun 98

SecC 3 Rohan 98

SecD 4 Soham 99

Q13. Given the df, write a program to print only name, age and position columns.

[Link] a program to iterate over a df containing names and marks, which then
calculates grades as per marks and adds them to the grade column. Marks>=90 A+,
marks70-90 A, marks 60-70 B, marks50-60 C, marks40-50 D, marks<40 F.
Q15. Use iterrows() to extract data from dataframe row wise:

Q16. The score of four teams in 5 IPL matches is available to you. Write a program to plot
these in a muliple bar chart.

[Link] has started an online business. A list stores the number of orders in last 6
months. Write a program to plot this data on a horizontal bar chart.

Q18. Given a data frame df1 as shown below-

Write code to create:


(a) A scatter chart from the yr1 to yr2 columns of dataframe df1.
(b) A line chart from the yr1 to yr2 columns of dataframe df2.
(c) Create a bar chart plotting the three columns of dataframe df1.
[Link] the following set of data:
Weight measurements for 16 small orders of French-Fries (in grams)
78 72 69 81 63 67 65 75
79 74 71 83 71 79 80 69

(a) Create a simple histogram from the above data


(b) Create a horizontal histogram from the above data
(c) Create a step type of histogram from the above data
(d) Create a cumulative histogram from the above data.

[Link] the following data frame [Link] a program to plot a bar chart with the
columns Rollno and Marks using the dataframe’s plot().

Rollno Name Marks

SecA 1 Rishi 97

SecB 2 Arun 98

SecC 3 Rohan 98

SecD 4 Soham 99

x x
[Link] a program to create two Series Object, one from a dictionary and
one from a numpy array.

Q2. Write a program to generate a series of float numbers from 41.0 to 60.0
with an increment of 2.5 each.

Q3. Create the following dataframe, and locate the three largest ‘Age’ values.
Q4. Create a dataframe for examination result and display the row labels,
column labels, data types of each column and the dimension of the dataframe

[Link] the above df and answer the following:


(a) Write a command to compute sum of column Age.
(b) Write a command to compute average of last 3 rows of Age column.
Q6. Create a df storing salesmen details (name, zone, sales) of five salesmen.

Q7 Write a Pandas program to create and display a DataFrame from a


specified dictionary data which has the index labels.

Q8. Write a Pandas program to create and display a DataFrame from a


specified dictionary data along with index labels.

Q9. Write a Pandas program to create the following dataframe and get the last 3
rows of a given DataFrame df.
The output should look as follows-

Q10. WAP to c r e a t e a S e r i e s s 1 Sort the values of a Series object s1 in


ascending order of its values and store it into series object s2.
Q11. Write a program to create data series and then change the indexes of the
Series object in any random order.

[Link] a program to change the column name Rollno to Rno of the


following df→

Rollno Name Marks

SecA 1 Rishi 97

SecB 2 Arun 98

SecC 3 Rohan 98

SecD 4 Soham 99

Q13. Given the df, write a program to print only name, age and position
columns.
[Link] a program to iterate over a df containing names and marks, which
then calculates grades as per marks and adds them to the grade column.
Marks>=90 A+, marks70-90 A, marks 60-70 B, marks50-60 C, marks40-50 D,
marks<40 F.
Q15. Use iterrows() to extract data from dataframe row wise:
Q16. The score of four teams in 5 IPL matches is available to you. Write a
program to plot these in a multiple bar chart.
[Link] has started an online business. A list stores the number of orders
in last 6 months. Write a program to plot this data on a horizontal bar chart.
Q18. Given a data frame df1 as shown below-

Write code to create:


(a)A scatter chart from the yr1 to yr2 columns of dataframe df1 .
(b) A line chart from the yr1 to yr2 columns of dataframe df2.
(c) Create a bar chart plotting the three columns of dataframe df1.

[Link] the following set of data:


Weight measurements for 16 small orders of French-Fries(in grams)
78 72 69 81 63 67 65 75
79 74 71 83 71 79 80 69
(a) Create a simple histogram from the above data
(b) Create a horizontal histogram from the above data
(c) Create a step type of histogram from the above data
(d) Create a cumulative histogram from the above data.
[Link] the following data frame [Link] a program to plot a bar chart
with the columns Rollno and Marks using the dataframe’s plot().

Rollno Name Marks

SecA 1 Rishi 97

SecB 2 Arun 98

SecC 3 Rohan 98

SecD 4 Soham 99

x--------------------------------------------x

You might also like