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

Experiment 9

The document contains Python code that reads a CSV file with data on various majors and their corresponding early and mid-career pay. It includes multiple visualizations such as line plots, bar charts, scatter plots, pie charts, and histograms to represent the data. The code aims to provide insights into the pay differences across different fields of study.
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)
20 views3 pages

Experiment 9

The document contains Python code that reads a CSV file with data on various majors and their corresponding early and mid-career pay. It includes multiple visualizations such as line plots, bar charts, scatter plots, pie charts, and histograms to represent the data. The code aims to provide insights into the pay differences across different fields of study.
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
You are on page 1/ 3

import pandas as pd

import matplotlib.pyplot as plt

df=pd.read_csv(r"C:\Users\Dell\AppData\Roaming\Microsoft\Windows\
Network Shortcuts\practical 8 dv.csv")

df

Major Early Career Pay Mid Career Pay


Percentage
0 Computer Science 70000 120000
25
1 Mechanical Engineering 68000 110000
20
2 Civil Engineering 62000 95000
15
3 Business Administration 60000 100000
18
4 Psychology 50000 85000
12
5 Education 48000 78000
10

plt.figure(figsize=(10,8))

<Figure size 1000x800 with 0 Axes>

<Figure size 1000x800 with 0 Axes>

plt.subplot(2,2,1)
plt.plot(df['Major'],df['Early Career Pay'],marker='o')
plt.title('Line Plot')

Text(0.5, 1.0, 'Line Plot')


plt.subplot(2,2,2)
plt.bar(df['Major'],df['Mid Career Pay'],color='purple')
plt.title('Bar CHART')

Text(0.5, 1.0, 'Bar CHART')

plt.subplot(2,2,4)
plt.scatter(df['Early Career Pay'],df['Mid Career
Pay'],color='yellow')
plt.title('Scatter Chart')
plt.xlabel('Early Career Pay')
plt.ylabel('Mid Career Pay')

Text(0, 0.5, 'Mid Career Pay')

plt.subplot(2,2,4)
plt.pie(df['Mid Career Pay'],labels=df['Major'],autopct='%1.1f%%')
plt.title('pie chart')

Text(0.5, 1.0, 'pie chart')


plt.subplot(3,2,6)
plt.hist(df['Early Career
Pay'],bins=5,color='purple',edgecolor='black')
plt.title('histogram chart')

Text(0.5, 1.0, 'histogram chart')

plt.subplot(3,2,5)
plt.barh(df['Mid Career Pay'],df['Early Career Pay'],color='skyblue')
plt.title('horizontal bar')

Text(0.5, 1.0, 'horizontal bar')

You might also like