Homepage Forums Dev & Debugging How do I remove the decimals from the dataframe? Reply To: How do I remove the decimals from the dataframe?

  • Ryan Brook

    Member
    December 22, 2020 at 9:33 pm
    13 Coins
    0 Gems
    Level: Rookie
    Helpful
    Up
    2
    Down
    Not Helpful

    Great question. Many face this conundrum, and there are actually a couple of ways to achieve this:

    1. Convert everything to integers – df.astype(int)
    2. Rounding up – df.round()
    3. Change your display precision option in Pandas – pd.set_option(‘precision’, 0)

    Depending on the type of data you are working with, you can choose which one works best for you.

New Report

Close