Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions RELEASE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ pandas 0.11.0
- Fixed missing tick bars on scatter_matrix plot (GH3063_)
- Fixed bug in Timestamp(d,tz=foo) when d is date() rather then datetime() (GH2993_)
- series.plot(kind='bar') now respects pylab color schem (GH3115_)
- Fixed bug in reshape if not passed correct input, now raises TypeError (GH2719_)

.. _GH2758: https://github.com/pydata/pandas/issues/2758
.. _GH2809: https://github.com/pydata/pandas/issues/2809
Expand All @@ -220,6 +221,7 @@ pandas 0.11.0
.. _GH622: https://github.com/pydata/pandas/issues/622
.. _GH797: https://github.com/pydata/pandas/issues/797
.. _GH2681: https://github.com/pydata/pandas/issues/2681
.. _GH2719: https://github.com/pydata/pandas/issues/2719
.. _GH2746: https://github.com/pydata/pandas/issues/2746
.. _GH2747: https://github.com/pydata/pandas/issues/2747
.. _GH2751: https://github.com/pydata/pandas/issues/2751
Expand Down
3 changes: 3 additions & 0 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,9 @@ def reshape(self, newshape, order='C'):
"""
See numpy.ndarray.reshape
"""
if order not in ['C','F']:
raise TypeError("must specify a tuple / singular length to reshape")

if isinstance(newshape, tuple) and len(newshape) > 1:
return self.values.reshape(newshape, order=order)
else:
Expand Down
4 changes: 4 additions & 0 deletions pandas/tests/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,10 @@ def test_reshape_non_2d(self):
x = Series(np.random.random(201), name='x')
self.assertRaises(TypeError, x.reshape, (len(x),))

# GH 2719
a = Series([1,2,3,4])
self.assertRaises(TypeError,a.reshape, 2, 2)

def test_reshape_2d_return_array(self):
x = Series(np.random.random(201), name='x')
result = x.reshape((-1, 1))
Expand Down