这个数据类型是怎么工作的,我只是对这个东西很着迷。你知道吗
1:首先使用python的默认类型:无法工作,rase错误
bins = pd.DataFrame(dtype=[str, int, int], columns=["chrom", "start", "end"])
raise error : TypeError: data type not understood
2:使用numpy的数据类型功能。它确实有效,但结果是错误的。你知道吗
bins = pd.DataFrame(dtype=np.dtype("str","int32","int32"), columns=["chrom", "start", "end"])
bins.dtypes
output:
chrom object
start object
end object
dtype: object
dtype参数是列名和dtype的字典。你知道吗
你的案子呢 pd.数据帧(数据类型:{'chron':str,'start':np.Int33型,“结束”:np.Int32型)你知道吗
您可以首先用列名定义} 更改类型,如下所示:
DataFrame
,然后用^{注意:我使用
object
作为类型来定义字符串列,这就是pandas
中text
列的定义方式相关问题 更多 >
编程相关推荐