the original data and pivotTable report
if I want to get the 1450 and give it to a variable,display it individually, how can I do?
my code is like this:
import pandas as pd
import streamlit as st
df=pd.read_csv("toushi.csv")
st.info("Original table")
st.write(df)
df1=df.pivot_table(index=['Dept'],values=['pay'],aggfunc=sum)
st.info("PivotTable report")
st.write(df1)
I get the solution:
import pandas as pd
import streamlit as st
df=pd.read_csv("toushi.csv")
st.info("Original table")
st.write(df)
df1=df.pivot_table(index=['Dept'],values=['pay'],aggfunc=sum)
st.info("PivotTable report")
st.write(df1)
df2=df.pivot_table(index=['Dept'],values=['pay'],aggfunc=sum).iloc[[0],[0]].values
st.success("PivotTable report result")
st.write(int(df2))
final result: