Python pandas HDFstore add frame with missing column

Let's say I already have an hdfstore having 3 columns [a, b, c] whose dtype is [uint32, int64, datetime64 [ns]]

The problem is how to add a dataframe with a missing column. Specify column "c" is missing, I am trying to add only [a, b], I cannot do it directly because dataframecannot match existing table structure

I'm trying to reindex a dataframe including column "c" and it still doesn't work because the new column "c" is NaN by default and its dtype is float64 still doesn't match.

So, I'm trying to change my dtype using .astype (datetime64 [ns]) , but this method doesn't work and the dtype hasn't changed.

Now I am stuck, how to add this partial data block to HDFstore?

+3


source to share





All Articles