I have the following DF.
symbol bid1Price ask1Price
datetime
2023-09-13 05:30:05.447 BTC-29SEP23-16000-C 0 0
2023-09-13 05:30:06.600 BTC-29SEP23-17000-C 0 0
2023-09-13 05:30:07.393 BTC-29SEP23-18000-C 5 0
2023-09-13 05:30:08.180 BTC-29SEP23-19000-C 0 0
2023-09-13 05:30:08.629 BTC-29SEP23-20000-C 5 0
...
‘symbol’ is Categorical:
Data columns (total 3 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 symbol 2332 non-null category
1 bid1Price 2332 non-null int64
2 ask1Price 2332 non-null int64
The idea is to plot all symbols (aka strikes) at the same graph. If i do .groupby(‘symbol’), then i can plot any strike from groupping. But why SNS fails with error?
sns.relplot(kind='line',
data=tmp1,
hue="symbol",
height=8,
aspect=2
)
ValueError: The following variable cannot be assigned with wide-form data: `hue`
I cannot undestand the meaning if the error. According to SNS documentaion
hue – vector or key in data
Grouping variable that will produce elements with different colors. Can be either categorical or numeric,
dfm = df.melt(id_vars='symbol', ignore_index=False).reset_index()
andsns.relplot(kind='line', data=dfm, x='datetime', y='value', hue='symbol', style='variable', height=8, aspect=2))