'Seaborn TypeError when trying to plot a relplot
I am trying to make a relplot using seaborn but I am getting a TypeError because my Y values are of type float.
Here is the code and Dataframe for the plot.
plt.figure(figsize=(20,15))
g = sns.relplot(x="Time", y="Total average Run", hue="Student Names", style="Student Names",
col="Student Names", col_wrap=3,
height=3, aspect=.75, linewidth=2.5,
kind="line", data=first_mean).set(title='Diff First vs Second Run');
g.fig.set_figwidth(16)
g.fig.set_figheight(15)
DataFrame
Total Time Student Names
0 0.00 09:00:00 Student A
1 6.20 10:30:00 Student A
2 -19.47 12:00:00 Student A
3 4.27 13:30:00 Student A
4 0.40 15:00:00 Student A
5 0.00 09:00:00 Student B
6 15.20 10:30:00 Student B
7 2.40 12:00:00 Student B
8 -5.80 13:30:00 Student B
9 -9.26 15:00:00 Student B
Error Traceback
TypeError Traceback (most recent call last)
~\anaconda3\lib\site-packages\pandas\_libs\lib.pyx in pandas._libs.lib.maybe_convert_numeric()
TypeError: Invalid object type
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_3520/838149277.py in <module>
1 # sns.set()
2 plt.figure(figsize=(20,15))
----> 3 g = sns.relplot(x="Time", y="Total average Run", hue="Student Names", style="Student Names",
4 col="Student Names", col_wrap=3,
5 height=3, aspect=.75, linewidth=2.5,
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
