What Is The Probability An Economy Class Seat Is An Aisle Seat?

20 Dec 2017

There are two types of people in the world, aisle seaters and window seaters. I am an aisle seater, nothing is worse than limited bathroom access on a long flight. The first thing I do when I get my ticket is check to see if I have a window seat. If not, I immediately head over to the airline counter and try to get one.

Last flight, on Turkish Airlines, I ran into a curious situation. I recieved my boarding pass with my seat number, 18C, but the ticket did not specify if C was an aisle seat or not. Making matters worse, the airline counter was swamped with a few dozen people. So I asked myself: given only the seat letter, C, what is the probability that it is an aisle seat?

Later, on the flight, I decided to find out.

Preliminaries

# Import required modulesimportpandasaspdimportnumpyasnp# Set plots to display in the iPython notebook%matplotlibinline

Setup possible seat configurations

I am a pretty frequently flyer on a variety of airlines and aircraft. There are a variety of seating configurations out there, but typically they follow some basic rules:

No window cluster of seats has more than three seats.

On small flights with three seats, the single seat is on the left side.

No flight has more than nine rows.

Based on these rules, here are the “typical” seating configurations from aircraft with between two and nine seats per row. A ‘1’ codifies that a seat is an aisle seat, a ‘0’ codifies that it is a non-aisle seat (i.e. window or middle), and ‘np.nan’ denotes that the aircraft has less than nine seats (this is so all the list lengths are the same).

# An aircraft with two seats per rowrows2=[1,1,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan]# An aircraft with three seats per rowrows3=[1,1,0,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,]# An aircraft with four seats per rowrows4=[0,1,1,0,np.nan,np.nan,np.nan,np.nan,np.nan]# An aircraft with five seats per rowrows5=[0,1,1,0,0,np.nan,np.nan,np.nan,np.nan]# An aircraft with six seats per rowrows6=[0,1,1,1,1,0,np.nan,np.nan,np.nan]# An aircraft with seven seats per rowrows7=[0,1,1,0,1,1,0,np.nan,np.nan]# An aircraft with eight seats per rowrows8=[0,0,1,1,1,1,0,0,np.nan]# An aircraft with nine seats per rowrows9=[0,0,1,1,0,1,1,0,0]

For example, in an aircraft with five seats per row, rows5, the seating arrangement would be:

window

aisle

aisle

middle

window

no seat

no seat

no seat

no seat

Next, I’m take advantage of pandas row summation options, but to do this I need to wrangle the data into a pandas dataframe. Essentially I am using the pandas dataframe as a matrix.

# Create a list variable of all possible aircraft configurationsseating_map=[rows2,rows3,rows4,rows5,rows6,rows7,rows8,rows9]

# Create a dataframe from the seating_map variabledf=pd.DataFrame(seating_map,columns=['A','B','C','D','E','F','G','H','I'],index=['rows2','rows3','rows4','rows5','rows6','rows7','rows8','rows9'])

Here is all the data we need to construct our probabilities. The columns represent individual seat letters (A, B, etc.) while the rows represent the number of seats-per-row in the aircraft.

# View the dataframedf

A

B

C

D

E

F

G

H

I

rows2

1

1

NaN

NaN

NaN

NaN

NaN

NaN

NaN

rows3

1

1

0.0

NaN

NaN

NaN

NaN

NaN

NaN

rows4

0

1

1.0

0.0

NaN

NaN

NaN

NaN

NaN

rows5

0

1

1.0

0.0

0.0

NaN

NaN

NaN

NaN

rows6

0

1

1.0

1.0

1.0

0.0

NaN

NaN

NaN

rows7

0

1

1.0

0.0

1.0

1.0

0.0

NaN

NaN

rows8

0

0

1.0

1.0

1.0

1.0

0.0

0.0

NaN

rows9

0

0

1.0

1.0

0.0

1.0

1.0

0.0

0.0

Calculate aisle probability

Because each aircraft seats-per-row configuration (i.e. row) is binary (1 if aisle, 0 if non-aisle), the probability that a seat is an aisle is simply the mean value of each seat letter (i.e. column).

# Create a list wherein each element is the mean value of a columnaisle_probability=[df['A'].mean(),df['B'].mean(),df['C'].mean(),df['D'].mean(),df['E'].mean(),df['F'].mean(),df['G'].mean(),df['H'].mean(),df['I'].mean()]

# Plot the probabilities, using 'seats' as the index as a bar chartpd.Series(aisle_probability,index=seats).plot(kind='bar',# set y to range between 0 and 1ylim=[0,1],# set the figure sizefigsize=[10,6],# set the figure titletitle='Probabilty of being an Aisle Seat in Economy Class')

<matplotlib.axes._subplots.AxesSubplot at 0x10f1231d0>

So there we have it! If given a boarding pass with seat C you have a 86% probability of being in an aisle seat!