forked from pandas-dev/pandas
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH: allow propgation and coexistance of numeric dtypes (closes GH pa…
…ndas-dev#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 pandas-dev#2793) added fully cythonized support for int8/int16 no support for float16 (it can exist, but no cython methods for it) TST: fixed test in test_from_records_sequencelike (dict orders can be different on different arch!) NOTE: using tuples will remove dtype info from the input stream (using a record array is ok though!) test updates for merging (multi-dtypes) added tests for replace (but skipped for now, algos not set for float32/16) tests for astype and convert in internals fixes for test_excel on 32-bit fixed test_resample_median_bug_1688 I belive separated out test_from_records_dictlike testing of panel constructors (GH pandas-dev#797) where ops now have a full test suite allow slightly less sensitive decimal tests for less precise dtypes BUG: fixed GH pandas-dev#2778, fillna on empty frame causes seg fault fixed bug in groupby where types were not being casted to original dtype respect the dtype of non-natural numeric (Decimal) don't upcast ints/bools to floats (if you say were agging on len, you can get an int) DOC: added astype conversion examples to whatsnew and docs (dsintro) updated RELEASE notes whatsnew for 0.10.2 added upcasting gotchas docs CLN: updated convert_objects to be more consistent across frame/series moved most groupby functions out of algos.pyx to generated.pyx fully support cython functions for pad/bfill/take/diff/groupby for float32 moved more block-like conversion loops from frame.py to internals.py (created apply method) (e.g. diff,fillna,where,shift,replace,interpolate,combining), to top-level methods in BlockManager
- 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.