Skip to content

Commit

Permalink
Merge pull request #2910 from pydata/applymap
Browse files Browse the repository at this point in the history
BUG: incorrect default in df.convert_objects was converting object types (#2909)
  • Loading branch information
jreback committed Feb 23, 2013
2 parents d54bda2 + 15f89ce commit 62bc073
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
25 changes: 16 additions & 9 deletions RELEASE.rst 100644 → 100755
Expand Up @@ -41,10 +41,11 @@ pandas 0.11.0
- added ``blocks`` attribute to DataFrames, to return a dict of dtypes to
homogeneously dtyped DataFrames
- added keyword ``convert_numeric`` to ``convert_objects()`` to try to
convert object dtypes to numeric types
convert object dtypes to numeric types (default is False)
- ``convert_dates`` in ``convert_objects`` can now be ``coerce`` which will
return a datetime64[ns] dtype with non-convertibles set as ``NaT``; will
preserve an all-nan object (e.g. strings)
preserve an all-nan object (e.g. strings), default is True (to perform
soft-conversion
- Series print output now includes the dtype by default
- Optimize internal reindexing routines (GH2819_, GH2867_)
- ``describe_option()`` now reports the default and current value of options.
Expand All @@ -69,12 +70,14 @@ pandas 0.11.0
- Integer block types will upcast as needed in where operations (GH2793_)
- Series now automatically will try to set the correct dtype based on passed
datetimelike objects (datetime/Timestamp)
- timedelta64 are returned in appropriate cases (e.g. Series - Series,
when both are datetime64)
- mixed datetimes and objects (GH2751_) in a constructor witll be casted
correctly
- astype on datetimes to object are now handled (as well as NaT
conversions to np.nan)

- timedelta64 are returned in appropriate cases (e.g. Series - Series,
when both are datetime64)
- mixed datetimes and objects (GH2751_) in a constructor witll be casted
correctly
- astype on datetimes to object are now handled (as well as NaT
conversions to np.nan)

- arguments to DataFrame.clip were inconsistent to numpy and Series clipping
(GH2747_)

Expand All @@ -92,14 +95,17 @@ pandas 0.11.0
overflow ``int64`` and some mixed typed type lists (GH2845_)
- Fix issue with slow printing of wide frames resulting (GH2807_)

``HDFStore``
- ``HDFStore``

- Fix weird PyTables error when using too many selectors in a where
- Provide dotted attribute access to ``get`` from stores
(e.g. store.df == store['df'])
- Internally, change all variables to be private-like (now have leading
underscore)

- Bug showing up in applymap where some object type columns are converted (GH2909_)
had an incorrect default in convert_objects

.. _GH622: https://github.com/pydata/pandas/issues/622
.. _GH797: https://github.com/pydata/pandas/issues/797
.. _GH2681: https://github.com/pydata/pandas/issues/2681
Expand All @@ -113,6 +119,7 @@ pandas 0.11.0
.. _GH2845: https://github.com/pydata/pandas/issues/2845
.. _GH2867: https://github.com/pydata/pandas/issues/2867
.. _GH2807: https://github.com/pydata/pandas/issues/2807
.. _GH2909: https://github.com/pydata/pandas/issues/2909

pandas 0.10.1
=============
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/frame.py 100644 → 100755
Expand Up @@ -1658,7 +1658,7 @@ def info(self, verbose=True, buf=None, max_cols=None):
def dtypes(self):
return self.apply(lambda x: x.dtype)

def convert_objects(self, convert_dates=True, convert_numeric=True):
def convert_objects(self, convert_dates=True, convert_numeric=False):
"""
Attempt to infer better dtype for object columns
Always returns a copy (even if no object columns)
Expand Down
9 changes: 9 additions & 0 deletions pandas/tests/test_frame.py 100644 → 100755
Expand Up @@ -6793,6 +6793,15 @@ def test_applymap(self):
result = self.frame.applymap(lambda x: (x, x))
self.assert_(isinstance(result['A'][0], tuple))

# GH 2909, object conversion to float in constructor?
df = DataFrame(data=[1,'a'])
result = df.applymap(lambda x: x)
self.assert_(result.dtypes[0] == object)

df = DataFrame(data=[1.,'a'])
result = df.applymap(lambda x: x)
self.assert_(result.dtypes[0] == object)

def test_filter(self):
# items

Expand Down

0 comments on commit 62bc073

Please sign in to comment.