0

I need to iterate over dataframe and access it's data.While accessing column values with for row in df.iterrows(): one of the float value is incorrectly converted from 16.67 to 16.669999999999998

Original data frame row:

row (25, song_name               ABC                  
work_id                                      582481039
artist_name                       XYZ         
artist_role                                           
channel_name                                   GENERAL
play_count                                            
invoice_date                                          
date_start                                  01/09/2017
date_end                                    30/09/2017
artist_share_percent                             16.67
amount                                            0.06
amount_currency                                       
income_type                                          P
adjustment_data                                       
Name: 25, dtype: object)

while I'm accessing artist_share_percent with row[1].artist_share_percent the value I'm getting is 16.669999999999998. I tried with itertuples(): but it's not working as well.Rounding of will not be possible for me. Please help me with this.

qwerty
  • 3
  • 7

0 Answers0