Oct-26-2023, 05:07 PM
Hi,
Im trying to solve this particular issue.
Im using two columns to display Price and Market.
Im trying to make Index for this as Market.
filtered_df - various columns including date column
Whats causing this issue for me ?
Thank You.
Im trying to solve this particular issue.
Im using two columns to display Price and Market.
lftcolumn, rghtcolumn = st.columns((9, 1)) with lftcolumn: pme_df = filtered_df.groupby(by = ["Market"], as_index = False)["Price"].sum().sort_values(by= ["Price"], ascending=False).reset_index() pmefig = px.bar(pme_df, x = "Market", y = "Price", text = ['${:,.2f}'.format(x) for x in pme_df["Price"]],template = "seaborn") pmefig.update_layout(xaxis_title="Market",yaxis_title="Price") st.plotly_chart(pmefig,use_container_width=True, height = 200) with rghtcolumn: # # st.subheader("Percentage") st.subheader(' "%" dif') procentai = pme_df['Price'] st.write(procentai.pct_change() * 100)Which is fine - it works but with % column i have numbers instead of Market as index.
Im trying to make Index for this as Market.
pme_df = filtered_df[["Market", "Price"]] pme_df = filtered_df.set_index(["Market", "Price"], inplace=True) pme_df = filtered_df.groupby(["Market", "Price"]).sum()
Error:TypeError: datetime64 type does not support sum operations
pme_df = filtered_df[["Market", "Price"]] pme_df = filtered_df.set_index(["Market", "Price"], inplace=True) pme_df = filtered_df.groupby(["Market"])["Price"].sum()
Error:KeyError: 'Column not found: Price'
pme_df = filtered_df[["Market", "Price"]] pme_df = filtered_df.set_index(["Market", "Price"], inplace=True) pme_df = filtered_df.groupby(["Market"]).sum()
Error:TypeError: datetime64 type does not support sum operations
Market contains market areas( string/object type column) and price ( float)filtered_df - various columns including date column
Whats causing this issue for me ?
Thank You.