text_html_output_1.png
import matplotlib.pyplot as plt

import pandas as pd

path = '/kaggle/input/h1bcsv/h1b.csv'

df = pd.read_csv(path)

# Counting the number of H-1B visa petitions for each case status
case_status_counts= df['CASE_STATUS'].value_counts()

# Creating a figure and axis object to plot the pie chart
fig, ax = plt.subplots(figsize=(8, 8))

# Plotting the pie chart with the case status counts and their respective percentages
plt.pie(case_status_counts, labels=case_status_counts.index, autopct='%1.1f%%', textprops={'fontsize': 8})

# Setting the title of the chart
plt.title('Petitions distributed by case statuses', y=1.1)

# Ensuring that the chart is properly displayed and not cut off
plt.tight_layout()

# Displaying the chart
plt.show()

top_employers = df['EMPLOYER_NAME'].value_counts().nlargest(20)
colors = ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf']
plt.bar(top_employers.index, top_employers.values, color=colors)
plt.xticks(rotation=90)
plt.title('Top employers filing the petitions')
plt.show()