text_html_output_1.png
import calendar

import matplotlib.pyplot as plt

import numpy as np # linear algebra

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

df = pd.read_excel('../input/flight_schedule.xlsx')

df.Date = pd.to_datetime(df.Date)
df.Time = df.Time.astype(str)
df.Time = pd.to_datetime(df.Time)

df['Weekday'] = df.Date.dt.weekday
df['Weekday'] = df['Weekday'].apply(lambda x: calendar.day_name[x])

weekdays_total=df.groupby('Weekday').size().plot.bar()
totals = []

# find the values and append to list
for i in weekdays_total.patches:
    totals.append(i.get_height())

# set individual bar lables using above list
total = sum(totals)

# set individual bar lables using above list
for i in weekdays_total.patches:
    # get_x pulls left or right; get_height pushes up or down
     weekdays_total.text(i.get_x()+.0, i.get_height()-0, \
            i.get_height(), fontsize=12,
                color='black')

grouped=df.groupby('Route').size().sort_values(ascending=False)
graph_grouped=grouped[:15].plot.bar(title='The most popular destinations weekly', figsize=(12,8))
# find the values and append to list
for i in graph_grouped.patches:
    totals.append(i.get_height())

# set individual bar lables using above list
total = sum(totals)

# set individual bar lables using above list
for i in graph_grouped.patches:
    # get_x pulls left or right; get_height pushes up or down
     graph_grouped.text(i.get_x()+.0, i.get_height()-0, \
            i.get_height(), fontsize=12,
                color='black')

df['Time'] = df.Time.dt.hour

tf = df.loc[df.Weekday.isin(['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'])]
workdays = tf.groupby(['Time', 'Weekday']).count()['Route'].unstack().plot(kind='line', linewidth=3.0, title='Other card distribution per hours', figsize=(18, 10))
workdays
plt.xticks(np.arange(0, 24, step=1))