-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote branch 'jreback/dtypes'
* jreback/dtypes: ENH: allow propgation and coexistance of numeric dtypes (closes GH #622) construction of multi numeric dtypes with other types in a dict validated get_numeric_data returns correct dtypes added blocks attribute (and as_blocks()) method that returns a dict of dtype -> homogeneous Frame to DataFrame added keyword 'raise_on_error' to astype, which can be set to false to exluded non-numeric columns fixed merging to correctly merge on multiple dtypes with blocks (e.g. float64 and float32 in other merger) changed implementation of get_dtype_counts() to use .blocks revised DataFrame.convert_objects to use blocks to be more efficient added Dtype printing to show on default with a Series added convert_dates='coerce' option to convert_objects, to force conversions to datetime64[ns] where can upcast integer to float as needed (on inplace ops #2793) added fully cythonized support for int8/int16 no support for float16 (it can exist, but no cython methods for it)
- Loading branch information
Showing
37 changed files
with
9,634 additions
and
3,178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
.. _whatsnew_0102: | ||
|
||
v0.10.2 (February ??, 2013) | ||
--------------------------- | ||
|
||
This is a minor release from 0.10.1 and includes many new features and | ||
enhancements along with a large number of bug fixes. There are also a number of | ||
important API changes that long-time pandas users should pay close attention | ||
to. | ||
|
||
API changes | ||
~~~~~~~~~~~ | ||
|
||
Numeric dtypes will propgate and can coexist in DataFrames. If a dtype is passed (either directly via the ``dtype`` keyword, a passed ``ndarray``, or a passed ``Series``, then it will be preserved in DataFrame operations. Furthermore, different numeric dtypes will **NOT** be combined. The following example will give you a taste. | ||
|
||
**Dtype Specification** | ||
|
||
.. ipython:: python | ||
|
||
df1 = DataFrame(randn(8, 1), columns = ['A'], dtype = 'float32') | ||
df1 | ||
df1.dtypes | ||
df2 = DataFrame(dict( A = Series(randn(8),dtype='float16'), B = Series(randn(8)), C = Series(randn(8),dtype='uint8') )) | ||
df2 | ||
df2.dtypes | ||
|
||
# here you get some upcasting | ||
df3 = df1.reindex_like(df2).fillna(value=0.0) + df2 | ||
df3 | ||
df3.dtypes | ||
|
||
**Dtype conversion** | ||
|
||
.. ipython:: python | ||
|
||
# this is lower-common-denomicator upcasting (meaning you get the dtype which can accomodate all of the types) | ||
df3.values.dtype | ||
|
||
# conversion of dtypes | ||
df3.astype('float32').dtypes | ||
|
||
# mixed type conversions | ||
df3['D'] = '1.' | ||
df3['E'] = '1' | ||
df3.convert_objects(convert_numeric=True).dtypes | ||
|
||
# same, but specific dtype conversion | ||
df3['D'] = df3['D'].astype('float16') | ||
df3['E'] = df3['E'].astype('int32') | ||
df3.dtypes | ||
|
||
# forcing date coercion | ||
s = Series([datetime(2001,1,1,0,0), 'foo', 1.0, 1, | ||
Timestamp('20010104'), '20010105'],dtype='O') | ||
s.convert_objects(convert_dates='coerce') | ||
|
||
**Upcasting Gotchas** | ||
|
||
Performing indexing operations on integer type data can easily upcast the data. | ||
The dtype of the input data will be preserved in cases where ``nans`` are not introduced (coming soon). | ||
|
||
.. ipython:: python | ||
|
||
dfi = df3.astype('int32') | ||
dfi['D'] = dfi['D'].astype('int64') | ||
dfi | ||
dfi.dtypes | ||
|
||
casted = dfi[dfi>0] | ||
casted | ||
casted.dtypes | ||
|
||
While float dtypes are unchanged. | ||
|
||
.. ipython:: python | ||
|
||
df4 = df3.copy() | ||
df4['A'] = df4['A'].astype('float32') | ||
df4.dtypes | ||
|
||
casted = df4[df4>0] | ||
casted | ||
casted.dtypes | ||
|
||
New features | ||
~~~~~~~~~~~~ | ||
|
||
**Enhancements** | ||
|
||
**Bug Fixes** | ||
|
||
See the `full release notes | ||
<https://github.com/pydata/pandas/blob/master/RELEASE.rst>`__ or issue tracker | ||
on GitHub for a complete list. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.