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

1. Load the Dataset “Airline_Dataset.csv” and perform the following operations on it.

a. Display the size of the dataset (Number of rows and Columns)


b. Display the names of the columns
c. Display first 10 rows of the dataset.
d. Display Data Types of columns
e. Find out the age of the youngest and oldest passenger.
import os
import pandas as pd
import matplotlib.pyplot as plt
os.chdir("D:\personal")
Airline_data=pd.read_csv("Airline_Dataset.csv",index_col=0)
Airline_size
Airline_data.columns
Airline_data.head(10)
Airline_data.dtypes
Airline_data['Age'].describe()

2. Load the Dataset “Airline_Dataset.csv” and perform the following operations on it.
a. Check if the dataset has any null value
b. Display the gender of passengers using appropriate plot.
genderdata=Airline_data['Gender'].value_counts()
genderdata.values.tolist()
genderindex=['Male', 'Female']
plt.bar(genderindex,genderdata)
plt.show()
genderdata=Airline_data['Gender'].value_counts()
genderdata.values.tolist()
genderindex=['Male', 'Female']
plt.bar(genderindex,genderdata)
plt.show()

3. Load the Dataset “Airline_Dataset.csv” and perform the following operations on it.
a. Display the nations of all passengers.
b. Display the top five nations that have maximum passengers using bar chart.
Nationalitydata=Airline_data['Nationality'].value_counts().nlargest(5)
Nationalitydata.values.tolist()
Nationalitydataindex=Airline_data['Nationality'].unique()
plt.bar(Nationalitydataindex[0:5],Nationalitydata)
plt.show()

4. Load the Dataset “Airline_Dataset.csv” and perform the following operations on it.
a. Display the names of all pilots.
b. Display the count of passengers from each country
c. Display the number of male and female passengers from each nation

Airline_data['Pilot Name'].value_counts
Airline_data['Nationality'].value_counts()
Airline_data.groupby(['Nationality','Gender']).size()

You might also like