Skip to content

Commit 26f6694

Browse files
committed
DOC: some docs re: Panel.from_dict with orient='minor', close #1009
1 parent 928da9d commit 26f6694

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

RELEASE.rst

+2
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ pandas 0.7.3
5555
(GH #977)
5656
- Notes on rpy2 installation (GH #1006)
5757
- Add rotation and font size options to hist method (#1012)
58+
- Use exogenous / X variable index in result of OLS.y_predict. Add
59+
OLS.predict method (PR #1027, #1008)
5860

5961
**API Changes**
6062

doc/source/dsintro.rst

+18-2
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,20 @@ For example, compare to the construction above:
687687
688688
Panel.from_dict(data, orient='minor')
689689
690-
Orient is especially useful for mixed-type DataFrames.
690+
Orient is especially useful for mixed-type DataFrames. If you pass a dict of
691+
DataFrame objects with mixed-type columns, all of the data will get upcasted to
692+
``dtype=object`` unless you pass ``orient='minor'``:
693+
694+
.. ipython:: python
695+
696+
df = DataFrame({'a': ['foo', 'bar', 'baz'],
697+
'b': np.random.randn(3)})
698+
df
699+
data = {'item1': df, 'item2': df}
700+
panel = Panel.from_dict(data, orient='minor')
701+
panel['a']
702+
panel['b']
703+
panel['b'].dtypes
691704
692705
.. note::
693706

@@ -751,7 +764,10 @@ For example, using the earlier example data, we could do:
751764
Conversion to DataFrame
752765
~~~~~~~~~~~~~~~~~~~~~~~
753766

754-
A Panel can be represented in 2D form as a hierarchically indexed DataFrame. See the section :ref:`hierarchical indexing <indexing.hierarchical>` for more on this. To convert a Panel to a DataFrame, use the ``to_frame`` method:
767+
A Panel can be represented in 2D form as a hierarchically indexed
768+
DataFrame. See the section :ref:`hierarchical indexing <indexing.hierarchical>`
769+
for more on this. To convert a Panel to a DataFrame, use the ``to_frame``
770+
method:
755771

756772
.. ipython:: python
757773

pandas/io/parsers.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ def _read(cls, filepath_or_buffer, kwds):
128128
else:
129129
errors = 'replace'
130130
encoding = 'utf-8'
131-
filepath_or_buffer = StringIO(filepath_or_buffer.read().decode(encoding, errors))
131+
bytes = filepath_or_buffer.read()
132+
filepath_or_buffer = StringIO(bytes.decode(encoding, errors))
132133

133134
if hasattr(filepath_or_buffer, 'read'):
134135
f = filepath_or_buffer

0 commit comments

Comments
 (0)