Skip to content

Commit

Permalink
DOC: added DataTypes section to HDFStore
Browse files Browse the repository at this point in the history
  • Loading branch information
jreback committed Feb 7, 2013
1 parent 1dbe01d commit eb2c048
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions doc/source/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1363,6 +1363,32 @@ Notes & Caveats
# we have provided a minimum minor_axis indexable size
store.root.wp_big_strings.table

DataTypes
~~~~~~~~~

``HDFStore`` will map an object dtype to the ``PyTables`` underlying dtype. This means the following types are known to work:

- floating : ``float64, float32, float16`` *(using* ``np.nan`` *to represent invalid values)*
- integer : ``int64, int32, int8, uint64, uint32, uint8``
- bool
- datetime64[ns] *(using* ``NaT`` *to represent invalid values)*
- object : ``strings`` *(using* ``np.nan`` *to represent invalid values)*

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]``,
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)

.. ipython:: python
import datetime
df = DataFrame(dict(datelike = Series([datetime.datetime(2001,1,1),datetime.datetime(2001,1,2),np.nan])))
df
df.dtypes
# to convert
df['datelike'] = Series(df['datelike'].values,dtype='M8[ns]')
df
df.dtypes
External Compatibility
~~~~~~~~~~~~~~~~~~~~~~

Expand Down

0 comments on commit eb2c048

Please sign in to comment.