I am trying to get a jointplot using Seaborn. My dataframe has three columns and looks like this
Sample pT Multiplicity
0 Jet1 132.2770 31
1 Jet1 181.0730 44
2 Jet1 118.1880 32
3 Jet1 155.7290 40
4 Jet1 250.8600 25
... ... ... ...
1995 Jet2 134.8610 25
1996 Jet2 192.9830 58
1997 Jet2 176.5910 33
1998 Jet2 60.8583 29
1999 Jet2 158.0140 54
When I try to use the following line sns.jointplot(x="pT", y="Multiplicity", hue="Sample", data=df)
I encounter the error TypeError: No loop matching the specified signature and casting was found for ufunc add
I have tried using categorical variables, but to no avail. When I don't use the 'hue' option, I encounter no error.
The datatypes for the objects are
Sample object
pT float64
Multiplicity object
dtype: object
Please help! Thanks
There is no any issue in your code. But your dtype of Multiplicity must be int64.
df['Multiplicity'] = df['Multiplicity'].astype(int)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.