Finding busiest flight route in india

Viewed 49

So I have to find busiest flight route in india from given csv file:

enter image description here

This data set is of 300k data. So I need to find busiest route and plot it. Let me show you my code:

# Importing Libarires
import pandas as pd
import matplotlib.pyplot as plt

df = pd.read_csv("Dataset.csv")

df['count'] =1       #initially, set that counter to 1.
group_data = df.groupby(['source_city','destination_city'])['count'].sum() #sum function
result = group_data.sort_values(ascending=False)
result

I'm unable to get the data and unable to store city name and count.

Please help me with this!

Output of trying:

group_data = df.groupby(['source_city','destination_city']).count()

enter image description here

1 Answers

try this:

group_data = df.groupby(['source_city','destination_city']).count()
Related