I am working with a dataframe, that unfortunately imports the column "ID" in the following format: 7.350943+e
I thought I fixed the issue with this code:
pd.set_option('display.float_format', lambda x: '%3.f' % x) However, this only fixes the display, in the back-end it remains in this scientific format.
When I try to create a new column based on column ID and column source, I get the following:
df['Primary_key']=df['ID'].apply(str)+'_'+df['Source'] Name ID Source Primary_key John 782857635 email 782857635.0_email What format do I need to change the datatype to in order to get rid of the .0?
df['ID'].values array([782929635.0, 783063368.0, 782960457.0, ..., 783257941.0, 783535550.0, nan], dtype=object) I tried replacing it, in the Primary key, but it didn't work (there was no change to the dataframe)
df['Primary_key']= df['Primary_key'].str.strip().replace(".0_","_")