The pd.DataFrame
docstring specifies a scalar argument for the whole dataframe:
dtype : dtype, default None
Data type to force, otherwise infer
Seemingly it is indeed intended to be a scalar, as following leads to an error:
dfbinseq = pd.DataFrame([],
columns = ["chr", "centre", "seq_binary"],
dtype = ["O", pd.np.int64, "O"])
dfbinseq = pd.DataFrame([],
columns = ["chr", "centre", "seq_binary"],
dtype = [pd.np.object, pd.np.int64, pd.np.object])
The only workaround for creating an empty data frame (which I need to put in a HDF5 store for further append
s) for me was
dfbinseq.centre.dtype = np.int64
Is there a way to set dtypes
arguments at once?