Get whole decimal digits for precision after Splitting List of float numbers in Pandas column

Viewed 59

i hav df with lat long as list

df:

coord
[-76.02140426635742, 32.88458068648376, 0.0]
[-76.02140426635742, 32.88458068648376, 0.0]

i used str.get(0)

df['lat']=df['coord'].str.get(0)

what i got is

coord lat
[-76.02140426635742, 32.88458068648376, 0.0] -76.021404
[-76.02140426635742, 32.88458068648376, 0.0] -76.021404

but i want the whole digits to be taken for precision.

expected output dataframe:

coord lat lon
[-76.02140426635742, 32.88458068648376, 0.0] -76.02140426635742 32.88458068648376
[-76.02140426635742, 32.88458068648376, 0.0] -76.02140426635742 32.88458068648376

Thank you...

1 Answers

Use:

import pandas as pd    
pd.set_option("precision", 14)

Pandas default to display 6 decimal places. You can change it to e.g. 14 decimal places as above.

Related