Skip to content

Commit 6eeff1a

Browse files
committed
DOC: add release notes/whatsnew
1 parent 0a83a1f commit 6eeff1a

File tree

5 files changed

+46
-15
lines changed

5 files changed

+46
-15
lines changed

RELEASE.rst

+8-6
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@ pandas 0.11.1
7777
dependencies offered for Linux) (GH3837_).
7878
- Plotting functions now raise a ``TypeError`` before trying to plot anything
7979
if the associated objects have have a dtype of ``object`` (GH1818_,
80-
GH3572_). This happens before any drawing takes place which elimnates any
81-
spurious plots from showing up.
80+
GH3572_, GH3911_, GH3912_), but they will try to convert object arrays to
81+
numeric arrays if possible so that you can still plot, for example, an
82+
object array with floats. This happens before any drawing takes place which
83+
elimnates any spurious plots from showing up.
8284
- Added Faq section on repr display options, to help users customize their setup.
8385
- ``where`` operations that result in block splitting are much faster (GH3733_)
8486
- Series and DataFrame hist methods now take a ``figsize`` argument (GH3834_)
@@ -341,13 +343,13 @@ pandas 0.11.1
341343
.. _GH3834: https://github.com/pydata/pandas/issues/3834
342344
.. _GH3873: https://github.com/pydata/pandas/issues/3873
343345
.. _GH3877: https://github.com/pydata/pandas/issues/3877
346+
.. _GH3659: https://github.com/pydata/pandas/issues/3659
347+
.. _GH3679: https://github.com/pydata/pandas/issues/3679
344348
.. _GH3880: https://github.com/pydata/pandas/issues/3880
345-
<<<<<<< HEAD
346349
.. _GH3911: https://github.com/pydata/pandas/issues/3911
347-
=======
348350
.. _GH3907: https://github.com/pydata/pandas/issues/3907
349-
>>>>>>> 7b5933247b80174de4ba571e95a1add809dd9d09
350-
351+
.. _GH3911: https://github.com/pydata/pandas/issues/3911
352+
.. _GH3912: https://github.com/pydata/pandas/issues/3912
351353

352354
pandas 0.11.0
353355
=============

doc/source/v0.11.1.txt

+7-3
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,11 @@ Bug Fixes
300300
~~~~~~~~~
301301

302302
- Plotting functions now raise a ``TypeError`` before trying to plot anything
303-
if the associated objects have have a ``dtype`` of ``object`` (GH1818_,
304-
GH3572_). This happens before any drawing takes place which elimnates any
305-
spurious plots from showing up.
303+
if the associated objects have have a dtype of ``object`` (GH1818_,
304+
GH3572_, GH3911_, GH3912_), but they will try to convert object arrays to
305+
numeric arrays if possible so that you can still plot, for example, an
306+
object array with floats. This happens before any drawing takes place which
307+
elimnates any spurious plots from showing up.
306308

307309
- ``fillna`` methods now raise a ``TypeError`` if the ``value`` parameter is
308310
a list or tuple.
@@ -416,3 +418,5 @@ on GitHub for a complete list.
416418
.. _GH3659: https://github.com/pydata/pandas/issues/3659
417419
.. _GH3679: https://github.com/pydata/pandas/issues/3679
418420
.. _GH3907: https://github.com/pydata/pandas/issues/3907
421+
.. _GH3911: https://github.com/pydata/pandas/issues/3911
422+
.. _GH3912: https://github.com/pydata/pandas/issues/3912

pandas/tests/test_graphics.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from pandas.util.testing import ensure_clean
1111
from pandas.core.config import set_option
1212

13+
1314
import numpy as np
1415

1516
from numpy.testing import assert_array_equal
@@ -198,11 +199,13 @@ def test_invalid_plot_data(self):
198199

199200
@slow
200201
def test_valid_object_plot(self):
202+
from pandas.io.pytables import PerformanceWarning
201203
s = Series(range(10), dtype=object)
202204
kinds = 'line', 'bar', 'barh', 'kde', 'density'
203205

204206
for kind in kinds:
205-
_check_plot_works(s.plot, kind=kind)
207+
tm.assert_warns(PerformanceWarning, _check_plot_works, s.plot,
208+
kind=kind)
206209

207210
def test_partially_invalid_plot_data(self):
208211
s = Series(['a', 'b', 1.0, 2])

pandas/tools/plotting.py

+14-5
Original file line numberDiff line numberDiff line change
@@ -877,16 +877,25 @@ def _get_layout(self):
877877
return (len(self.data.columns), 1)
878878

879879
def _compute_plot_data(self):
880+
from pandas.io.pytables import PerformanceWarning
880881
try:
881882
# might be a frame
882883
numeric_data = self.data._get_numeric_data()
883884
except AttributeError:
884-
# attempt soft conversion
885-
numeric_data = self.data.convert_objects()
885+
numeric_data = self.data
886+
orig_dtype = numeric_data.dtype
886887

887-
# a series, but no object dtypes allowed!
888-
if numeric_data.dtype == np.object_:
889-
raise TypeError('invalid dtype for plotting')
888+
if orig_dtype == np.object_:
889+
# attempt soft conversion, but raise a perf warning
890+
numeric_data = numeric_data.convert_objects()
891+
num_data_dtype = numeric_data.dtype
892+
893+
if num_data_dtype == np.object_:
894+
raise TypeError('No numeric data to plot')
895+
else:
896+
warnings.warn('Coerced object dtype to numeric dtype, '
897+
'you should avoid object dtyped Series if '
898+
'possible', PerformanceWarning)
890899

891900
try:
892901
is_empty = numeric_data.empty

pandas/util/testing.py

+13
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import string
88
import sys
99
import tempfile
10+
import warnings
1011

1112
from contextlib import contextmanager # contextlib is available since 2.5
1213

@@ -746,3 +747,15 @@ def stdin_encoding(encoding=None):
746747
sys.stdin = SimpleMock(sys.stdin, "encoding", encoding)
747748
yield
748749
sys.stdin = _stdin
750+
751+
752+
def assert_warns(warning, f, *args, **kwargs):
753+
"""
754+
From: http://stackoverflow.com/questions/3892218/how-to-test-with-pythons-unittest-that-a-warning-has-been-thrown
755+
"""
756+
with warnings.catch_warnings(record=True) as warning_list:
757+
warnings.simplefilter('always')
758+
f(*args, **kwargs)
759+
msg = '{0!r} not raised'.format(warning)
760+
assert any(issubclass(item.category, warning)
761+
for item in warning_list), msg

0 commit comments

Comments
 (0)