i have 9 values that i calculate and store in variables, now i want to make a radar chart out of these values. After looking at some tutorials i wanted to make a data frame out of the data, like in the following exaple. I only need one colum in the first step.
df2 = pd.DataFrame(np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]),
columns=['a', 'b', 'c'])
df2
a b c
0 1 2 3
1 4 5 6
2 7 8 9
thats the example i found on pandas.pydata.org
so i tried this
df2 = pd.DataFrame(np.array([avgac], [avgda], [avgen], [avgin], [avgke], [avgli], [avglo], [avgsp], [avgva]),
columns=['values']
)
If i try to run this i get an error (ValueError: only 2 non-keyword arguments accepted) my values which i want to use are in these variables avgac... when i print them it looks like this
print("acousticness: ", avgac, ...
acousticness: 0.20569285714285715 ....
How could i make a radar chart out of these variables?
Just create the dataframe in this way:
a=1;b=2;c=3;d=4
df2 = pd.DataFrame({"Variable":[a,b,c,d],"Name": ["a","b","c","d"]})
Replace a,b,c,d.. with the name of your variables. Then you can use plotly to make the radar chart:
import plotly.express as px
fig = px.line_polar(df2, r="Variable", theta='Name', line_close=True)
fig.show()