I have a pandas DataFrame myDF
with a few string columns (whose dtype
is object
) and many numeric columns. I tried the following:
d=pandas.HDFStore("C:\\PF\\Temp.h5")
d['test']=myDF
I got this result:
C:\PF\WinPython-64bit-3.3.3.3\python-3.3.3.amd64\lib\site-packages\pandas\io\pytables.py:2446: PerformanceWarning:
your performance may suffer as PyTables will pickle object types that it cannot
map directly to c-types [inferred_type->mixed,key->block2_values]
[items->[0, 1, 3, 4, 5, 6, 9, 10, 292, ...]]
warnings.warn(ws, PerformanceWarning)
It seems like the issue is occurring for every column that is a string. For example if I try
myDF[0].dtype
I get
Out[38]: dtype('O')
How can I fix the issue, i.e. change the dtype
for string columns so that HDFStore can treat it like a string column?
EDIT
More info as requested
>>> pandas.__version__
Out[49]: '0.13.1'
>>> tables.__version__
Out[53]: '3.1.0'
Constructing the pandas data frame as follows:
pandas.read_csv(fName,sep="|",header=None, low_memory=False)
When I try
myDF.info()
I get
Int64Index: 153895 entries, 0 to 153894
Data columns (total 644 columns):
0 object
1 object
2 int64
3 object
4 object
5 object
6 object
7 int64
8 float64
9 object
10 object
11 float64
12 float64
...
...
642 float64
643 float64
dtypes: float64(619), int64(2), object(23)
All string columns have been read as object
.