Open wei2912 opened 1 month ago
2024-11-02 14:40:43.595 503 GET /script-health-check (127.0.0.1) 25381.00ms
────────────────────── Traceback (most recent call last) ───────────────────────
/home/adminuser/venv/lib/python3.11/site-packages/streamlit/runtime/scriptru
nner/exec_code.py:88 in exec_func_with_error_handling
/home/adminuser/venv/lib/python3.11/site-packages/streamlit/runtime/scriptru
nner/script_runner.py:590 in code_to_exec
/mount/src/mentorship-streamlit/streamlit_app.py:15 in <module>
12 │ ]
13 )
14 st.set_page_config(page_title="Streamlit Dashboard", page_icon="📈", la
❱ 15 pg.run()
16
/home/adminuser/venv/lib/python3.11/site-packages/streamlit/navigation/page.
py:291 in run
/mount/src/mentorship-streamlit/pages/home.py:118 in <module>
115 │ st.dataframe(pie_chart(df))
116
117 else:
❱ 118 │ st.dataframe(bar_chart(df))
119
/mount/src/mentorship-streamlit/auxiliary_functions.py:93 in bar_chart
90 │ pie_chart_col.plotly_chart(fig_pie)
91
92 def bar_chart(df):
❱ 93 │ df_10 = df.groupby(['name']).size().to_frame().sort_values([0], asc
94 │ fig_bar = px.bar(df_10.value_counts(), x=df['Product Category'].val
95 │ │ │ │ │ labels={'x': 'Industry', 'y': 'Count'}, title='Top
96 │ bar_chart_col.plotly_chart(fig_bar)
/home/adminuser/venv/lib/python3.11/site-packages/pandas/core/frame.py:9183
in groupby
9180 │ │ if level is None and by is None:
9181 │ │ │ raise TypeError("You have to supply one of 'by' and 'lev
9182 │ │
❱ 9183 │ │ return DataFrameGroupBy(
9184 │ │ │ obj=self,
9185 │ │ │ keys=by,
9186 │ │ │ axis=axis,
/home/adminuser/venv/lib/python3.11/site-packages/pandas/core/groupby/groupb
y.py:1329 in __init__
1326 │ │ self.dropna = dropna
1327 │ │
1328 │ │ if grouper is None:
❱ 1329 │ │ │ grouper, exclusions, obj = get_grouper(
1330 │ │ │ │ obj,
1331 │ │ │ │ keys,
1332 │ │ │ │ axis=axis,
/home/adminuser/venv/lib/python3.11/site-packages/pandas/core/groupby/groupe
r.py:1043 in get_grouper
1040 │ │ │ elif obj._is_level_reference(gpr, axis=axis):
1041 │ │ │ │ in_axis, level, gpr = False, gpr, None
1042 │ │ │ else:
❱ 1043 │ │ │ │ raise KeyError(gpr)
1044 │ │ elif isinstance(gpr, Grouper) and gpr.key is not None:
1045 │ │ │ # Add key to exclusions
1046 │ │ │ exclusions.add(gpr.key)
────────────────────────────────────────────────────────────────────────────────
KeyError: 'name'
Sometimes this works and sometimes this doesn't. I don't recall seeing this issue before merging, though I haven't attempted to replicate it on my local Streamlit instance yet...