I am trying to display the percentage of each column and run into the error-- IndexError: index 3 is out of bounds for axis 0 with size 3
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
% matplotlib inline
import seaborn as sns
df = pd.read_csv('https://github.com/Kevin-ck1/Intro-To-Data-Science/raw/master/hotel_bookings.csv')
df_booking = df.copy()
df_booking['percentage'] = round(df_booking['arrival_date_year']/df_booking['arrival_date_year'].sum() * 100, 1)
df_booking['arrival_date_year'].value_counts(dropna=True).plot(kind="bar")
xlocs, xlabs = plt.xticks()
for i, v in enumerate(df_booking['percentage']):
plt.text(xlocs[i] - 0.08, v + 25, str(v) + '%', fontsize = 15)
plt.title('Booking')
plt.show()
The error message given is
IndexError Traceback (most recent call last)
<ipython-input-59-07b4659a45f8> in <module>()
21 for i, v in enumerate(df_booking['percentage']):
22
---> 23 plt.text(xlocs[i] - 0.08, v + 25, str(v) + '%', fontsize = 15)
24
25 plt.title('Booking')
IndexError: index 3 is out of bounds for axis 0 with size 3