Skip to content

Commit eb2c048

Browse files
committed
DOC: added DataTypes section to HDFStore
1 parent 1dbe01d commit eb2c048

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

doc/source/io.rst

+26
Original file line numberDiff line numberDiff line change
@@ -1363,6 +1363,32 @@ Notes & Caveats
13631363
# we have provided a minimum minor_axis indexable size
13641364
store.root.wp_big_strings.table
13651365

1366+
DataTypes
1367+
~~~~~~~~~
1368+
1369+
``HDFStore`` will map an object dtype to the ``PyTables`` underlying dtype. This means the following types are known to work:
1370+
1371+
- floating : ``float64, float32, float16`` *(using* ``np.nan`` *to represent invalid values)*
1372+
- integer : ``int64, int32, int8, uint64, uint32, uint8``
1373+
- bool
1374+
- datetime64[ns] *(using* ``NaT`` *to represent invalid values)*
1375+
- object : ``strings`` *(using* ``np.nan`` *to represent invalid values)*
1376+
1377+
Currently, ``unicode`` and ``datetime`` columns (represented with a dtype of ``object``), **WILL FAIL**. In addition, even though a column may look like a ``datetime64[ns]``,
1378+
if it contains ``np.nan``, this **WILL FAIL**. You can try to convert datetimelike columns to proper ``datetime64[ns]`` columns, that possibily contain ``NaT`` to represent invalid values. (Some of these issues have been addressed and these conversion may not be necessary in future versions of pandas)
1379+
1380+
.. ipython:: python
1381+
1382+
import datetime
1383+
df = DataFrame(dict(datelike = Series([datetime.datetime(2001,1,1),datetime.datetime(2001,1,2),np.nan])))
1384+
df
1385+
df.dtypes
1386+
1387+
# to convert
1388+
df['datelike'] = Series(df['datelike'].values,dtype='M8[ns]')
1389+
df
1390+
df.dtypes
1391+
13661392
External Compatibility
13671393
~~~~~~~~~~~~~~~~~~~~~~
13681394

0 commit comments

Comments
 (0)