text_plain_output_1.png image_output_1.png
import matplotlib.pyplot as plt

import pandas as pd

import seaborn as sns

airline_data = pd.read_csv('../input/airline-passenger-satisfaction/airline_passenger_satisfaction.csv')
data_dic = pd.read_csv('../input/airline-passenger-satisfaction/data_dictionary.csv')

airline_data.shape

airline_data.isnull().sum()

airline_data.duplicated().sum()

des = airline_data.describe()
d = des.iloc[[1,5],:]
d.style.background_gradient(cmap='viridis')

# YELLOW represent the MAX.

airline_data.nunique()

airline_data.columns

cols = ['Departure and Arrival Time Convenience', 'Ease of Online Booking', 'Check-in Service', 'Online Boarding', 'Gate Location', 'On-board Service', 'Seat Comfort', 'Leg Room Service', 'Cleanliness', 'Food and Drink', 'In-flight Service', 'In-flight Wifi Service', 'In-flight Entertainment', 'Baggage Handling']

def create_plot_pivot(df, x_column):
    """ Create a pivot table for satisfaction versus another rating for easy plotting. """
    _df_plot = df.groupby([x_column, 'Satisfaction']).size().reset_index().pivot(columns='Satisfaction', index=x_column, values=0)
    return _df_plot

fig, ax = plt.subplots(7, 2, figsize=(20, 40))
axe = ax.ravel()
for i in range(14):
    create_plot_pivot(airline_data, cols[i]).plot(kind='bar', stacked=True, ax=axe[i])
    plt.xlabel(cols[i])
    axe[i].set_ylabel('Count of Passengers')
fig.show()