1

when I do the calculations in the dataframe using Python, it returns the scientific notations results...Is there method making the results without scientific notations (just return the float)? Those highlighted number should be 0.

enter image description here

Thanks for the help.

2
  • Do you want to round them ? Or just get the full float ? Commented Oct 19, 2018 at 16:00
  • I need the full float. But those highlighted numbers should be 0. I have no idea why Python returns those format... Commented Oct 19, 2018 at 16:03

1 Answer 1

1

Option1: You can use one option: display.precision: pd.set_option('precision', 5)

Options and Settings

Option2: You can use float format:

pd.options.display.float_format = '${:,.5f}'.format

Option3: you can use the round:

DataFrame.round(decimals=0, *args, **kwargs) to can round close to the nearest number:

df.round(5) # for whole dataframe

pandas.DataFrame.round

Sign up to request clarification or add additional context in comments.

2 Comments

Yes, in all the cases keep the decimal to 5 and you can change the way your requirements. Mostly I use display.float_format and works all the time.
Got it. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.