Skip to content

Commit 1e01d9c

Browse files
committed
DOC: v0.15.2 edits
1 parent e0680ec commit 1e01d9c

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

doc/source/io.rst

+11-8
Original file line numberDiff line numberDiff line change
@@ -1996,20 +1996,20 @@ indices to be parsed.
19961996

19971997
It is possible to transform the contents of Excel cells via the `converters`
19981998
option. For instance, to convert a column to boolean:
1999-
1999+
20002000
.. code-block:: python
2001-
2001+
20022002
read_excel('path_to_file.xls', 'Sheet1', converters={'MyBools': bool})
2003-
2003+
20042004
This options handles missing values and treats exceptions in the converters
20052005
as missing data. Transformations are applied cell by cell rather than to the
20062006
column as a whole, so the array dtype is not guaranteed. For instance, a
20072007
column of integers with missing values cannot be transformed to an array
20082008
with integer dtype, because NaN is strictly a float. You can manually mask
20092009
missing data to recover integer dtype:
2010-
2010+
20112011
.. code-block:: python
2012-
2012+
20132013
cfun = lambda x: int(x) if x else -1
20142014
read_excel('path_to_file.xls', 'Sheet1', converters={'MyInts': cfun})
20152015
@@ -3098,13 +3098,16 @@ Categorical Data
30983098

30993099
.. versionadded:: 0.15.2
31003100

3101-
Writing data (`Series`, `Frames`) to a HDF store that contains a ``category`` dtype was implemented
3102-
in 0.15.2. Queries work the same as if it was an object array (but the ``Categorical`` is stored in a more efficient manner)
3101+
Writing data to a ``HDFStore`` that contains a ``category`` dtype was implemented
3102+
in 0.15.2. Queries work the same as if it was an object array. However, the ``category`` dtyped data is
3103+
stored in a more efficient manner.
31033104

31043105
.. ipython:: python
31053106
31063107
dfcat = DataFrame({ 'A' : Series(list('aabbcdba')).astype('category'),
31073108
'B' : np.random.randn(8) })
3109+
dfcat
3110+
dfcat.dtypes
31083111
cstore = pd.HDFStore('cats.h5', mode='w')
31093112
cstore.append('dfcat', dfcat, format='table', data_columns=['A'])
31103113
result = cstore.select('dfcat', where="A in ['b','c']")
@@ -3113,7 +3116,7 @@ in 0.15.2. Queries work the same as if it was an object array (but the ``Categor
31133116
31143117
.. warning::
31153118

3116-
The format of the ``Categoricals` is readable by prior versions of pandas (< 0.15.2), but will retrieve
3119+
The format of the ``Categorical`` is readable by prior versions of pandas (< 0.15.2), but will retrieve
31173120
the data as an integer based column (e.g. the ``codes``). However, the ``categories`` *can* be retrieved
31183121
but require the user to select them manually using the explicit meta path.
31193122

doc/source/whatsnew/v0.15.2.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ Enhancements
4242
~~~~~~~~~~~~
4343

4444
- Added ability to export Categorical data to Stata (:issue:`8633`).
45-
- Added ability to export Categorical data to to/from HDF5 (:issue:`7621`). Queries work the same as if it was an object array (but a ``Categorical`` is stored in a much more efficient manner). See :ref:`here <io.hdf5-categorical>` for an example and caveats w.r.t. prior versions of pandas.
45+
- Added ability to export Categorical data to to/from HDF5 (:issue:`7621`). Queries work the same as if it was an object array. However, the ``category`` dtyped data is
46+
stored in a more efficient manner. See :ref:`here <io.hdf5-categorical>` for an example and caveats w.r.t. prior versions of pandas.
4647

4748
.. _whatsnew_0152.performance:
4849

0 commit comments

Comments
 (0)