Creating Histogram
Histogram: a graphical display of data using bars of different heights.It is similar to a Bar Chart, but a histogram groups numbers into ranges,
Histograms are a great way to show results of continuous data, such as:
- weight
- height
- how much time
- etc.
But when the data is in categories (such as Country or Favorite Movie), we should use a Bar Chart.
A histogram is a graphical representation of the distribution of numerical data. It is an estimate of the probability distribution of a continuous variable (quantitative variable) and was first introduced by Karl Pearson.
Reading And writing Comma-Separated data
Comma-separated values (CSV) is a way of expressing structured data in flat text files:
Code will showing the Names of all routes in that file: Reading Airport DataLet's get deeper into the code. As you see below, we are working with two different input dataset 1. airports.dat to get airport details and 2. routes.dat to get route details. And now we've to calculate geo_distance from both those data and record it in a list distance[] |
Airline Route Histogram:
The distance we measure is the "great circle distance".
In order to calculate "great circle distance"., we have to import a module named geo distance , a pre-built function geo_distance.distance() helps us in calculating the distance of each airline route.
Histogram:
Plot a histogram based on the route lengths to show the distribution of different flight distances.