Formatting Numbers with AgGrid

Hello,
My code and screen shot are below.

How can I format the numbers in columns to percentage or round a number ?

df_exc= pd.read_excel(yol) 
  gb = GridOptionsBuilder.from_dataframe(df_exc)
  gb.configure_pagination()
  gb.configure_column("Env_Oran", cellStyle={'color': 'red'})
  gb.configure_selection(selection_mode="single", use_checkbox=True)
  
  gridOptions = gb.build()

  AgGrid(df_exc, gridOptions=gridOptions)  
  
  #data = AgGrid(df_exc, gridOptions=gridOptions, enable_enterprise_modules=True, allow_unsafe_jscode=True, update_mode=GridUpdateMode.SELECTION_CHANGED)
 

I found such a solution using pandas round function and gb.configure_column

df_exc['Env_Oran']= df_exc['Env_Oran']*100
 #df_exc['Env_Oran']= df_exc['Env_Oran'].round(2)
 if os.path.exists(yol)==True:
  'Dosya Burda bir daha hesaplama'
 else:
  'Dosya yok' 
 gb = GridOptionsBuilder.from_dataframe(df_exc)
 gb.configure_pagination()
 gb.configure_column("Env_Oran", type=["customCurrencyFormat"], custom_currency_symbol="%")
1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.