Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
358 views
in Technique[技术] by (71.8m points)

pandas - Convert string to float64 in Python DataFrame


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

What you see is just the default string representation with 6 decimal places. You can set you own display format option with

pd.options.display.float_format = '{:.10f}'.format

to show 10 places. Alternatively you can confirm the number if you look at the result of say df.loc[1,'lng'].

To set the option only temporarily you can use an option context:

with pd.option_context('display.float_format', '{:.10f}'.format):
    print(df)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...