- I am running my app locally.
- I don’t have github repository
- streamlit==1.10.0, , Python==3.6.8
I have Pandas dataframe with some columns with numbers and one column is the name of the months, corresponding to the index:
{
“Network Devices”: {
“8”: 100,
“9”: 130,
“10”: 220,
“11”: 537,
“12”: 643
},
“Total IPs”: {
“8”: 430,
“9”: 540,
“10”: 750,
“11”: 820,
“12”: 1280
},
“Month”: {
“8”: “August”,
“9”: “September”,
“10”: “October”,
“11”: “November”,
“12”: “December”
}
}
I am trying to create a bar chart for every column with the month name as X axis.
This code below works and creates nice bar charts with the index as X-axis and proper Y-axis values:
for col in df.columns:
if col != ‘Month’ :
st.bar_chart(data=df_mean[col])
Every time I am trying to add “x=…” parameter to st.bar_chart like
st.bar_chart(data=df[col], x=df[‘Month’])
I have error:
**TypeError: bar_chart() got an unexpected keyword argument ‘x’
Traceback:
File "/home/denis/DevInt/.venv/lib64/python3.6/site-packages/streamlit/scriptrunner/script_runner.py", line 554, in _run_script
exec(code, module.__dict__)
File "/home/denis/DevInt/pages/StatPage.py", line 58, in <module>
st.bar_chart(data=df[col], x=df['Month'])
**
What I am doing wrong?