I’ve been trying for a while to make a simple bar plot of features importance, with data from a dataframe. But unfortunately, i’ve been having no sucess.
Following the documentation, the first thing i tried was a simple:
chart_data = pd.DataFrame(columns=features)
chart_data.loc[0, :] = feature_importances
But it produced the following:
Then i found the following topic and decided to create a chart constructor like so (also changed the dataframe so it is easier to assign each column):
chart_data = pd.DataFrame()
chart_data[‘features’] = features
chart_data[‘feature_importance’] = feature_importances
chart = alt.Chart(chart_data).mark_bar().encode(
st.write("", “”, chart_v1)
But still, all i got was this:
(sorry, new users can only upload a single image)
Which is even worse as no bars are shown whatsoever, even with the height parameter specified as 120 (had the same result when it used the default value of 0).
So, am I missing something? Is there any tip you can give me to plot this simple bar graph?
Thanks in advance!