0% found this document useful (0 votes)
10 views3 pages

Python Data Science Practical Tasks

The document outlines a practical course for Python for Data Science at Government Engineering College Dahod, detailing various programming tasks. These tasks include file operations, NumPy array manipulations, and data visualization using Pandas and Matplotlib. It serves as a guide for students to develop their skills in Python programming and data analysis.

Uploaded by

apsavani4518
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)
10 views3 pages

Python Data Science Practical Tasks

The document outlines a practical course for Python for Data Science at Government Engineering College Dahod, detailing various programming tasks. These tasks include file operations, NumPy array manipulations, and data visualization using Pandas and Matplotlib. It serves as a guide for students to develop their skills in Python programming and data analysis.

Uploaded by

apsavani4518
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

GOVERNMENT ENGINEERING COLLEGE DAHOD

COMPUTER ENGINEERING DEPARTMENT


Sample Practical
Course Code : COMP507 (3150713) Sem : 5
Course Name : PYTHON FOR DATA SCIENCE Term : Even 2024-25
Sr No Title of Program
1. Write a Python program to read an entire text file.
2. Write a Python program to append text to a file and display the text.
3. Write a Python program to copy the contents of a file to another file .
4. Write a Python program to sum all the items in a list
5. Write a Python program to concatenate following dictionaries to create a new one.
6. Write a Python program to iterate over dictionaries using for loops
7. Write a NumPy program to create a 3x3 identity matrix and stack it vertically and horizontally.
8. Write a NumPy program to find the dot product of two arrays of different dimensions.
9. Write a NumPy program to create a 4x4 array with random values and find the sum of each row.
10. Write a NumPy program to create a 3x3 array with random values and subtract the mean of each row from
each element
11. Write a NumPy program to create a 3x3 array with random values and subtract the mean of each column from
each element.
12. Write a NumPy program to create a 5x5 array with random values and normalize it row-wise.
13. Write a NumPy program to create a 5x5 array with random values and normalize it column-wise.
14. Write a NumPy program to create a 3x3x3 array with random values and find the sum along the last axis.
15. Write a NumPy program to create a 5x5 array with random values and sort each row.
16. Write a NumPy program to create a 5x5 array with random values and sort each column.
17. Write a Pandas program to select rows where the value in the 'A' column is greater than 4.
18. Write a Pandas program to select only the 'X' and 'Y' columns from the DataFrame.
19. Write a Pandas program that uses .loc for indexing.
20. Write a Pandas program that uses .loc to slice DataFrame based on row and column labels.
21. Write a Pandas program to read a csv file from a specified source and print the first 5 rows.
22. Write a Python Pandas program to get the columns of the DataFrame (movies_metadata.csv file).
23. Write a Python Pandas program to read movies_metadata.csv file. And to print the details of the third movie of
the DataFrame
24. Write a Pandas program to check for missing values in a dataset.
25. Write a Pandas program to drop rows with missing values from a dataset.
26. Write a Pandas program that fills missing values with the Mean.
27. Write a Python program to draw a line with suitable label in the x axis, y axis and a title.
28. Write a Python program to draw line charts of the financial data of Alphabet Inc. between October 3, 2016 to
October 7, 2016.
Sample Financial data ([Link]):
Date,Open,High,Low,Close
10-03-16,774.25,776.065002,769.5,772.559998
10-04-16,776.030029,778.710022,772.890015,776.429993
10-05-16,779.309998,782.070007,775.650024,776.469971
10-06-16,779,780.47998,775.539978,776.859985
10-07-16,779.659973,779.659973,770.75,775.080017

29. Write a Python programming to display a bar chart of the popularity of programming Languages.
Sample data:
Programming languages: Java, Python, PHP, JavaScript, C#, C++
Popularity: 22.2, 17.6, 8.8, 8, 7.7, 6.7
30. Write a Python programming to display a horizontal bar chart of the popularity of programming Languages.
Sample data:
Programming languages: Java, Python, PHP, JavaScript, C#, C++
Popularity: 22.2, 17.6, 8.8, 8, 7.7, 6.7
31. Write a Python programming to display a bar chart of the popularity of programming Languages. Use uniform
color.
Sample data:
Programming languages: Java, Python, PHP, JavaScript, C#, C++
Popularity: 22.2, 17.6, 8.8, 8, 7.7, 6.7
32. Write a Python programming to display a bar chart of the popularity of programming Languages. Use different
color for each bar.
Sample data:
Programming languages: Java, Python, PHP, JavaScript, C#, C++
Popularity: 22.2, 17.6, 8.8, 8, 7.7, 6.7
33. Write a Python programming to display a bar chart of the popularity of programming Languages. Attach a text
label above each bar displaying its popularity (float value).
Sample data:
Programming languages: Java, Python, PHP, JavaScript, C#, C++
Popularity: 22.2, 17.6, 8.8, 8, 7.7, 6.7
34. Write a Python programming to display a bar chart of the popularity of programming Languages. Make blue
border to each bar.
Sample data:
Programming languages: Java, Python, PHP, JavaScript, C#, C++
Popularity: 22.2, 17.6, 8.8, 8, 7.7, 6.7
35. Write a Python programming to display a bar chart of the popularity of programming Languages. Specify the
position of each bar plot.
Sample data:
Programming languages: Java, Python, PHP, JavaScript, C#, C++
Popularity: 22.2, 17.6, 8.8, 8, 7.7, 6.7
36. Write a Python programming to display a bar chart of the popularity of programming Languages. Select the
width of each bar and their positions.
Sample data:
Programming languages: Java, Python, PHP, JavaScript, C#, C++
Popularity: 22.2, 17.6, 8.8, 8, 7.7, 6.7
37. Write a Python program to create bar plot of scores by group and gender. Use multiple X values on the same
chart for men and women.

Sample Data:
Means (men) = (22, 30, 35, 35, 26)
Means (women) = (25, 32, 30, 35, 29)

38. Write a Python program to create bar plot from a DataFrame.


Sample Data Frame:
abcde
2 4,8,5,7,6
4 2,3,4,2,6
6 4,7,4,7,8
8 2,6,4,8,6
10 2,4,3,3,2
39. Write a Python program to create a stacked bar plot with error bars.
Note: Use bottom to stack the women?s bars on top of the men?s bars.
Sample Data:
Means (men) = (22, 30, 35, 35, 26)
Means (women) = (25, 32, 30, 35, 29)
Men Standard deviation = (4, 3, 4, 1, 5)
Women Standard deviation = (3, 5, 2, 3, 3
40. Write a Python program to create a horizontal bar chart with differently ordered colors.
Note: Use bottom to stack the women?s bars on top of the men?s bars.
Sample Data Set:
languages = [['Language',' Science','Math'],
['Science','Math','Language'],
['Math','Language','Science']]
numbers = [{'Language':75, 'Science':88, 'Math':96},
{'Language':71, 'Science':95, 'Math':92},
{'Language':75, 'Science':90, 'Math':89}]
41. Write a Python program to create stack bar plot and add label to each section.
Sample data:
people = ('G1','G2','G3','G4','G5','G6','G7','G8')
segments = 4
# multi-dimensional data
data = [[ 3.40022085, 7.70632498, 6.4097905, 10.51648577, 7.5330039, 7.1123587, 12.77792868, 3.44773477],
[ 11.24811149, 5.03778215, 6.65808464, 12.32220677, 7.45964195, 6.79685302, 7.24578743, 3.69371847],
[ 3.94253354, 4.74763549, 11.73529246, 4.6465543, 12.9952182, 4.63832778, 11.16849999, 8.56883433],
[ 4.24409799, 12.71746612, 11.3772169, 9.00514257, 10.47084185, 10.97567589, 3.98287652, 8.80552122]]

You might also like