|
1 | 1 | .. _whatsnew_0180: |
2 | 2 |
|
3 | | -v0.18.0 (February ??, 2016) |
4 | | ---------------------------- |
| 3 | +v0.18.0 (March 13, 2016) |
| 4 | +------------------------ |
5 | 5 |
|
6 | 6 | This is a major release from 0.17.1 and includes a small number of API changes, several new features, |
7 | 7 | enhancements, and performance improvements along with a large number of bug fixes. We recommend that all |
@@ -607,9 +607,9 @@ Subtraction by ``Timedelta`` in a ``Series`` by a ``Timestamp`` works (:issue:`1 |
607 | 607 | Changes to msgpack |
608 | 608 | ^^^^^^^^^^^^^^^^^^ |
609 | 609 |
|
610 | | -Forward incompatible changes in ``msgpack`` writing format were made over 0.17.0 and 0.18.0; older versions of pandas cannot read files packed by newer versions (:issue:`12129`, `10527`) |
| 610 | +Forward incompatible changes in ``msgpack`` writing format were made over 0.17.0 and 0.18.0; older versions of pandas cannot read files packed by newer versions (:issue:`12129`, :issue:`10527`) |
611 | 611 |
|
612 | | -Bug in ``to_msgpack`` and ``read_msgpack`` introduced in 0.17.0 and fixed in 0.18.0, caused files packed in Python 2 unreadable by Python 3 (:issue:`12142`). The following table describes the backward and forward compat of msgpacks. |
| 612 | +Bugs in ``to_msgpack`` and ``read_msgpack`` introduced in 0.17.0 and fixed in 0.18.0, caused files packed in Python 2 unreadable by Python 3 (:issue:`12142`). The following table describes the backward and forward compat of msgpacks. |
613 | 613 |
|
614 | 614 | .. warning:: |
615 | 615 |
|
@@ -745,58 +745,6 @@ You could also specify a ``how`` directly |
745 | 745 | 2010-01-01 09:00:06 1.249976 1.219477 1.266330 1.224904 |
746 | 746 | 2010-01-01 09:00:08 1.020940 1.068634 1.146402 1.613897 |
747 | 747 |
|
748 | | -.. warning:: |
749 | | - |
750 | | - This new API for resample includes some internal changes for the prior-to-0.18.0 API, to work with a deprecation warning in most cases, as the resample operation returns a deferred object. We can intercept operations and just do what the (pre 0.18.0) API did (with a warning). Here is a typical use case: |
751 | | - |
752 | | - .. code-block:: python |
753 | | - |
754 | | - In [4]: r = df.resample('2s') |
755 | | - |
756 | | - In [6]: r*10 |
757 | | - pandas/tseries/resample.py:80: FutureWarning: .resample() is now a deferred operation |
758 | | - use .resample(...).mean() instead of .resample(...) |
759 | | - |
760 | | - Out[6]: |
761 | | - A B C D |
762 | | - 2010-01-01 09:00:00 4.857476 4.473507 3.570960 7.936154 |
763 | | - 2010-01-01 09:00:02 8.208011 7.943173 3.640340 5.310957 |
764 | | - 2010-01-01 09:00:04 4.339846 3.145823 4.241039 6.257326 |
765 | | - 2010-01-01 09:00:06 6.249881 6.097384 6.331650 6.124518 |
766 | | - 2010-01-01 09:00:08 5.104699 5.343172 5.732009 8.069486 |
767 | | - |
768 | | - However, getting and assignment operations directly on a ``Resampler`` will raise a ``ValueError``: |
769 | | - |
770 | | - .. code-block:: python |
771 | | - |
772 | | - In [7]: r.iloc[0] = 5 |
773 | | - ValueError: .resample() is now a deferred operation |
774 | | - use .resample(...).mean() instead of .resample(...) |
775 | | - assignment will have no effect as you are working on a copy |
776 | | - |
777 | | - There is a situation where the new API can not perform all the operations when using original code. |
778 | | - This code is intending to resample every 2s, take the ``mean`` AND then take the ``min` of those results. |
779 | | - |
780 | | - .. code-block:: python |
781 | | - |
782 | | - In [4]: df.resample('2s').min() |
783 | | - Out[4]: |
784 | | - A 0.433985 |
785 | | - B 0.314582 |
786 | | - C 0.357096 |
787 | | - D 0.531096 |
788 | | - dtype: float64 |
789 | | - |
790 | | - The new API will: |
791 | | - |
792 | | - .. ipython: python |
793 | | - |
794 | | - df.resample('2s').min() |
795 | | - |
796 | | - Good news is the return dimensions will differ (between the new API and the old API), so this should loudly raise |
797 | | - an exception. |
798 | | - |
799 | | - |
800 | 748 | **New API**: |
801 | 749 |
|
802 | 750 | Now, you can write ``.resample`` as a 2-stage operation like groupby, which |
@@ -886,6 +834,60 @@ New API |
886 | 834 |
|
887 | 835 | In the new API, you can either downsample OR upsample. The prior implementation would allow you to pass an aggregator function (like ``mean``) even though you were upsampling, providing a bit of confusion. |
888 | 836 |
|
| 837 | +Previous API will work but deprecations |
| 838 | +''''''''''''''''''''''''''''''''''''''' |
| 839 | + |
| 840 | +.. warning:: |
| 841 | + |
| 842 | + This new API for resample includes some internal changes for the prior-to-0.18.0 API, to work with a deprecation warning in most cases, as the resample operation returns a deferred object. We can intercept operations and just do what the (pre 0.18.0) API did (with a warning). Here is a typical use case: |
| 843 | + |
| 844 | + .. code-block:: python |
| 845 | + |
| 846 | + In [4]: r = df.resample('2s') |
| 847 | + |
| 848 | + In [6]: r*10 |
| 849 | + pandas/tseries/resample.py:80: FutureWarning: .resample() is now a deferred operation |
| 850 | + use .resample(...).mean() instead of .resample(...) |
| 851 | + |
| 852 | + Out[6]: |
| 853 | + A B C D |
| 854 | + 2010-01-01 09:00:00 4.857476 4.473507 3.570960 7.936154 |
| 855 | + 2010-01-01 09:00:02 8.208011 7.943173 3.640340 5.310957 |
| 856 | + 2010-01-01 09:00:04 4.339846 3.145823 4.241039 6.257326 |
| 857 | + 2010-01-01 09:00:06 6.249881 6.097384 6.331650 6.124518 |
| 858 | + 2010-01-01 09:00:08 5.104699 5.343172 5.732009 8.069486 |
| 859 | + |
| 860 | + However, getting and assignment operations directly on a ``Resampler`` will raise a ``ValueError``: |
| 861 | + |
| 862 | + .. code-block:: python |
| 863 | + |
| 864 | + In [7]: r.iloc[0] = 5 |
| 865 | + ValueError: .resample() is now a deferred operation |
| 866 | + use .resample(...).mean() instead of .resample(...) |
| 867 | + assignment will have no effect as you are working on a copy |
| 868 | + |
| 869 | + There is a situation where the new API can not perform all the operations when using original code. |
| 870 | + This code is intending to resample every 2s, take the ``mean`` AND then take the ``min` of those results. |
| 871 | + |
| 872 | + .. code-block:: python |
| 873 | + |
| 874 | + In [4]: df.resample('2s').min() |
| 875 | + Out[4]: |
| 876 | + A 0.433985 |
| 877 | + B 0.314582 |
| 878 | + C 0.357096 |
| 879 | + D 0.531096 |
| 880 | + dtype: float64 |
| 881 | + |
| 882 | + The new API will: |
| 883 | + |
| 884 | + .. ipython:: python |
| 885 | + |
| 886 | + df.resample('2s').min() |
| 887 | + |
| 888 | + The good news is the return dimensions will differ between the new API and the old API, so this should loudly raise |
| 889 | + an exception. |
| 890 | + |
889 | 891 | Changes to eval |
890 | 892 | ^^^^^^^^^^^^^^^ |
891 | 893 |
|
|
0 commit comments