Before using I was able to set decimals as shown below
format_dict = {f: "{:,.2f}" for f in fields}
st.dataframe(pdf.style.format(format_dict))
How can I limit number of decimals when I use Ag-Grid.
Thank you.
Before using I was able to set decimals as shown below
format_dict = {f: "{:,.2f}" for f in fields}
st.dataframe(pdf.style.format(format_dict))
How can I limit number of decimals when I use Ag-Grid.
Thank you.
Hi @kannaiah
You could try the this when configuring the column in AGgrid:
gb = GridOptionsBuilder.from_dataframe(df) # where df = your dataframe ref variable
gb.configure_column(YourColumnNameHeader, type=[“numericColumn”,“numberColumnFilter”,“customNumericFormat”], precision=1)
Cheers
This worked for columns with floating point values.
I have a column with a list, and this did not affect that column
Hi @kannaiah
Then I think you will need to use list comprehension on each value of the data frame column before passing the data frame to aggrid
Cheers
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.