I am new to data analysis. I am currently using seaborn 0.13.1 along with pandas 2.2.0 and I was messing around with the following code:
import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
exam_scores1 = [62.58, 67.63, 81.37, 52.53, 62.98, 72.15, 59.05, 73.85, 97.24, 76.81, 89.34, 74.44, 68.52, 85.13, 90.75, 70.29, 75.62, 85.38, 77.82, 98.31, 79.08, 61.72, 71.33, 80.77, 80.31, 78.16, 61.15, 64.99, 72.67, 78.94]
exam_scores2 = [72.38, 71.28, 79.24, 83.86, 84.42, 79.38, 75.51, 76.63, 81.48,78.81,79.23,74.38,79.27,81.07,75.42,90.35,82.93,86.74,81.33,95.1,86.57,83.66,85.58,81.87,92.14,72.15,91.64,74.21,89.04,76.54,81.9,96.5,80.05,74.77,72.26,73.23,92.6,66.22,70.09,77.2]
data = np.concatenate([np.array(exam_scores1), np.array(exam_scores2)])
labels = ['1st Yr Teaching'] * len(exam_scores1) + ['2nd Yr Teaching'] * len(exam_scores2)
df = pd.DataFrame({'Score': data, 'Teaching Year': labels})
plt.figure(figsize=(10, 8))
sns.histplot(data=df, x='Score', hue=df['Teaching Year'], bins=12, kde=True, stat='density', linewidth=2)
plt.title("Final Exam Score Distribution")
plt.xlabel("Percentage")
plt.ylabel("Density")
plt.legend(title='Teaching Year')
plt.savefig('my_histogram_seaborn.png')
plt.show()
The plot is generated successfully but I am getting the following futurewarning from seaborn:
FutureWarning: When grouping with a length-1 list-like, you will need to pass a length-1 tuple to get_group in a future version of pandas. Pass `(name,)` instead of `name` to silence this warning.
data_subset = grouped_data.get_group(pd_key)
What does this mean? TIA
I tried to understand the thing first, as I am new I can't get a hold of the thing