Skip to content

Commit 4a28342

Browse files
committed
Add this PR's changes to the documentation
1 parent 909d1f5 commit 4a28342

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

CHANGES.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ CHANGES
33
0.5.1 (2018-01-)
44
-----------------
55
- Address Unicode decode error when installing with pip3 on docker (Thanks @utapyngo)
6+
- Fix `#63 <https://github.com/chrisdev/django-pandas/issues/63>`_: Use memory
7+
efficient iteration in ``read_frame`` (by @wkschwartz)
8+
- Add ``compress`` argument to ``read_frame`` to infer NumPy data types for the
9+
returned data frame's columns from the Django field types (by @wkschwartz)
610

711
0.5.0 (2018-01-20)
812
------------------

README.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Contributors
2525
* `@henhuy <https://github.com/henhuy>`_
2626
* `Hélio Meira Lins <https://github.com/meiralins>`_
2727
* `@utpyngo <https://github.com/utpyngo>`_
28+
* `William Schwartz <https://github.com/wkschwartz>`_
2829

2930
What's New
3031
===========
@@ -119,6 +120,23 @@ read_frame
119120
human readable versions of any foreign key or choice fields
120121
else use the actual values set in the model.
121122

123+
- compress: a false value, ``True``, or a mapping, default False
124+
If a true value, infer `NumPy data types
125+
<https://docs.scipy.org/doc/numpy/user/basics.types.html>`_ for
126+
Pandas dataframe columns from the corresponding Django field
127+
types. For example, Django's built in ``SmallIntgerField`` is
128+
cast to NumPy's ``int16``. If ``compress`` is a mapping (e.g., a
129+
``dict``), it should be a mapping with Django field subclasses
130+
as keys and `NumPy dtypes
131+
<https://docs.scipy.org/doc/numpy/reference/arrays.dtypes.html>`_
132+
as values. This mapping overrides the defualts for the field
133+
classes appearing in the mapping. However, the inference is
134+
based on the field subclass lowest on a chain of subclasses,
135+
that is, in order of inheritence. To override
136+
``SmallIntegerField`` it is therefore not sufficient to override
137+
``IntegerField``. Careful of setting ``compress={}`` because
138+
``{}`` is a false value in Python, which would cause
139+
``read_frame`` not to compress columns.
122140

123141
Examples
124142
^^^^^^^^^

0 commit comments

Comments
 (0)