Pandas:从 numpy 创建数据框,保留原始格式
Pandas: creating dataframe from numpy preserving the original format
假设你有这个 numpy 数组:
a=array([[ 9.81650352, 10.03896523, 10.26972675],...])
创建以下数据框时如何保留它的 8(或 n)位十进制数字?
df = pandas.DataFrame({'column':a})
根据以上评论,为了将来参考,this is the way to go 如果有 8
个小数:
import numpy
import pandas
a=array([[ 9.81650352, 10.03896523, 10.26972675]])
pandas.set_option('precision',8)
df = pandas.DataFrame({'column':a})
假设你有这个 numpy 数组:
a=array([[ 9.81650352, 10.03896523, 10.26972675],...])
创建以下数据框时如何保留它的 8(或 n)位十进制数字?
df = pandas.DataFrame({'column':a})
根据以上评论,为了将来参考,this is the way to go 如果有 8
个小数:
import numpy
import pandas
a=array([[ 9.81650352, 10.03896523, 10.26972675]])
pandas.set_option('precision',8)
df = pandas.DataFrame({'column':a})