@@ -677,65 +677,65 @@ data-types would yield different return types. These are now made consistent. (:
677
677
678
678
- Datetime tz-aware
679
679
680
- Previous behaviour:
680
+ Previous behaviour:
681
681
682
- .. code-block :: ipython
682
+ .. code-block :: ipython
683
683
684
- # Series
685
- In [5]: pd.Series([pd.Timestamp('20160101', tz='US/Eastern'),
686
- ...: pd.Timestamp('20160101', tz='US/Eastern')]).unique()
687
- Out[5]: array([Timestamp('2016-01-01 00:00:00-0500', tz='US/Eastern')], dtype=object)
684
+ # Series
685
+ In [5]: pd.Series([pd.Timestamp('20160101', tz='US/Eastern'),
686
+ ...: pd.Timestamp('20160101', tz='US/Eastern')]).unique()
687
+ Out[5]: array([Timestamp('2016-01-01 00:00:00-0500', tz='US/Eastern')], dtype=object)
688
688
689
- In [6]: pd.unique(pd.Series([pd.Timestamp('20160101', tz='US/Eastern'),
690
- ...: pd.Timestamp('20160101', tz='US/Eastern')]))
691
- Out[6]: array(['2016-01-01T05:00:00.000000000'], dtype='datetime64[ns]')
689
+ In [6]: pd.unique(pd.Series([pd.Timestamp('20160101', tz='US/Eastern'),
690
+ ...: pd.Timestamp('20160101', tz='US/Eastern')]))
691
+ Out[6]: array(['2016-01-01T05:00:00.000000000'], dtype='datetime64[ns]')
692
692
693
- # Index
694
- In [7]: pd.Index([pd.Timestamp('20160101', tz='US/Eastern'),
695
- ...: pd.Timestamp('20160101', tz='US/Eastern')]).unique()
696
- Out[7]: DatetimeIndex(['2016-01-01 00:00:00-05:00'], dtype='datetime64[ns, US/Eastern]', freq=None)
693
+ # Index
694
+ In [7]: pd.Index([pd.Timestamp('20160101', tz='US/Eastern'),
695
+ ...: pd.Timestamp('20160101', tz='US/Eastern')]).unique()
696
+ Out[7]: DatetimeIndex(['2016-01-01 00:00:00-05:00'], dtype='datetime64[ns, US/Eastern]', freq=None)
697
697
698
- In [8]: pd.unique([pd.Timestamp('20160101', tz='US/Eastern'),
699
- ...: pd.Timestamp('20160101', tz='US/Eastern')])
700
- Out[8]: array(['2016-01-01T05:00:00.000000000'], dtype='datetime64[ns]')
698
+ In [8]: pd.unique([pd.Timestamp('20160101', tz='US/Eastern'),
699
+ ...: pd.Timestamp('20160101', tz='US/Eastern')])
700
+ Out[8]: array(['2016-01-01T05:00:00.000000000'], dtype='datetime64[ns]')
701
701
702
- New Behavior:
702
+ New Behavior:
703
703
704
- .. ipython :: python
704
+ .. ipython :: python
705
705
706
- # Series, returns an array of Timestamp tz-aware
707
- pd.Series([pd.Timestamp(r ' 20160101' , tz = r ' US/Eastern' ),
708
- pd.Timestamp(r ' 20160101' , tz = r ' US/Eastern' )]).unique()
709
- pd.unique(pd.Series([pd.Timestamp(' 20160101' , tz = ' US/Eastern' ),
710
- pd.Timestamp(' 20160101' , tz = ' US/Eastern' )]))
706
+ # Series, returns an array of Timestamp tz-aware
707
+ pd.Series([pd.Timestamp(r ' 20160101' , tz = r ' US/Eastern' ),
708
+ pd.Timestamp(r ' 20160101' , tz = r ' US/Eastern' )]).unique()
709
+ pd.unique(pd.Series([pd.Timestamp(' 20160101' , tz = ' US/Eastern' ),
710
+ pd.Timestamp(' 20160101' , tz = ' US/Eastern' )]))
711
711
712
- # Index, returns a DatetimeIndex
713
- pd.Index([pd.Timestamp(' 20160101' , tz = ' US/Eastern' ),
714
- pd.Timestamp(' 20160101' , tz = ' US/Eastern' )]).unique()
715
- pd.unique(pd.Index([pd.Timestamp(' 20160101' , tz = ' US/Eastern' ),
716
- pd.Timestamp(' 20160101' , tz = ' US/Eastern' )]))
712
+ # Index, returns a DatetimeIndex
713
+ pd.Index([pd.Timestamp(' 20160101' , tz = ' US/Eastern' ),
714
+ pd.Timestamp(' 20160101' , tz = ' US/Eastern' )]).unique()
715
+ pd.unique(pd.Index([pd.Timestamp(' 20160101' , tz = ' US/Eastern' ),
716
+ pd.Timestamp(' 20160101' , tz = ' US/Eastern' )]))
717
717
718
718
- Categoricals
719
719
720
- Previous behaviour:
720
+ Previous behaviour:
721
721
722
- .. code-block :: ipython
722
+ .. code-block :: ipython
723
723
724
- In [1]: pd.Series(list('baabc'), dtype='category').unique()
725
- Out[1]:
726
- [b, a, c]
727
- Categories (3, object): [b, a, c]
724
+ In [1]: pd.Series(list('baabc'), dtype='category').unique()
725
+ Out[1]:
726
+ [b, a, c]
727
+ Categories (3, object): [b, a, c]
728
728
729
- In [2]: pd.unique(pd.Series(list('baabc'), dtype='category'))
730
- Out[2]: array(['b', 'a', 'c'], dtype=object)
729
+ In [2]: pd.unique(pd.Series(list('baabc'), dtype='category'))
730
+ Out[2]: array(['b', 'a', 'c'], dtype=object)
731
731
732
- New Behavior:
732
+ New Behavior:
733
733
734
- .. ipython :: python
734
+ .. ipython :: python
735
735
736
- # returns a Categorical
737
- pd.Series(list (' baabc' ), dtype = ' category' ).unique()
738
- pd.unique(pd.Series(list (' baabc' ), dtype = ' category' ))
736
+ # returns a Categorical
737
+ pd.Series(list (' baabc' ), dtype = ' category' ).unique()
738
+ pd.unique(pd.Series(list (' baabc' ), dtype = ' category' ))
739
739
740
740
.. _whatsnew_0200.api_breaking.s3 :
741
741
@@ -1081,48 +1081,48 @@ joins, :meth:`DataFrame.join` and :func:`merge`, and the ``.align`` method.
1081
1081
1082
1082
.. ipython :: python
1083
1083
1084
- left = pd.Index([2 , 1 , 0 ])
1085
- left
1086
- right = pd.Index([1 , 2 , 3 ])
1087
- right
1084
+ left = pd.Index([2 , 1 , 0 ])
1085
+ left
1086
+ right = pd.Index([1 , 2 , 3 ])
1087
+ right
1088
1088
1089
1089
Previous Behavior:
1090
1090
1091
1091
.. code-block :: ipython
1092
1092
1093
- In [4]: left.intersection(right)
1094
- Out[4]: Int64Index([1, 2], dtype='int64')
1093
+ In [4]: left.intersection(right)
1094
+ Out[4]: Int64Index([1, 2], dtype='int64')
1095
1095
1096
1096
New Behavior:
1097
1097
1098
1098
.. ipython :: python
1099
1099
1100
- left.intersection(right)
1100
+ left.intersection(right)
1101
1101
1102
1102
- ``DataFrame.join `` and ``pd.merge ``
1103
1103
1104
1104
.. ipython :: python
1105
1105
1106
- left = pd.DataFrame({' a' : [20 , 10 , 0 ]}, index = [2 , 1 , 0 ])
1107
- left
1108
- right = pd.DataFrame({' b' : [100 , 200 , 300 ]}, index = [1 , 2 , 3 ])
1109
- right
1106
+ left = pd.DataFrame({' a' : [20 , 10 , 0 ]}, index = [2 , 1 , 0 ])
1107
+ left
1108
+ right = pd.DataFrame({' b' : [100 , 200 , 300 ]}, index = [1 , 2 , 3 ])
1109
+ right
1110
1110
1111
1111
Previous Behavior:
1112
1112
1113
1113
.. code-block :: ipython
1114
1114
1115
- In [4]: left.join(right, how='inner')
1116
- Out[4]:
1117
- a b
1118
- 1 10 100
1119
- 2 20 200
1115
+ In [4]: left.join(right, how='inner')
1116
+ Out[4]:
1117
+ a b
1118
+ 1 10 100
1119
+ 2 20 200
1120
1120
1121
1121
New Behavior:
1122
1122
1123
1123
.. ipython :: python
1124
1124
1125
- left.join(right, how = ' inner' )
1125
+ left.join(right, how = ' inner' )
1126
1126
1127
1127
.. _whatsnew_0200.api_breaking.pivot_table :
1128
1128
0 commit comments