pandas: powerful Python data analysis toolkit - 0.25-0.130327 -0.372906 1.072236 5 5.0 A where operation with setting. In [52]: df2 = df.copy() In [53]: df2[df2 > 0] = -df2 In [54]: df2 Out[54]: A B C D F 2013-01-01 0.000000 0.000000 -1.793547 -5 evaluate single-element pandas objects in a boolean context, use the method bool(): In [53]: pd.Series([True]).bool() Out[53]: True In [54]: pd.Series([False]).bool() Out[54]: False In [55]: pd.DataFrame([[True]]) describe() Out[101]: count 9 unique 4 top a freq 5 dtype: object 3.3. Essential basic functionality 53 pandas: powerful Python data analysis toolkit, Release 0.25.3 Note that on a mixed-type DataFrame0 码力 | 698 页 | 4.91 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 0.21.152 1.5.2.3 Accessing datetime fields of Index now return Index . . . . . . . . . . . . . . . . . 53 1.5.2.4 pd.unique will now be consistent with extension types . . . . . . . . . . . . . . . . 54 freq='2Q-DEC') New Behavior: In [52]: pi = pd.period_range('2017-01', periods=12, freq='M') In [53]: s = pd.Series(np.arange(12), index=pi) In [54]: resampled = s.resample('2Q').mean() In [55]: resampled below: 46 Chapter 1. What’s New pandas: powerful Python data analysis toolkit, Release 0.21.1 In [53]: np.random.seed(24) In [54]: df = pd.DataFrame({'A': np.linspace(1, 10, 10)}) In [55]: df = pd.concat([df0 码力 | 2207 页 | 8.59 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 0.20.3. . . . . . . . . . . . . . . . . . . . . . . . . 53 1.6.1.1 merge_asof for asof-style time-series joining . . . . . . . . . . . . . . . . . . . 53 1.6.1.2 .rolling() is now time-series aware . . . 1.3. v0.20.1 (May 5, 2017) 17 pandas: powerful Python data analysis toolkit, Release 0.20.3 In [53]: np.random.seed(24) In [54]: df = pd.DataFrame({'A': np.linspace(1, 10, 10)}) In [55]: df = pd.concat([df time-series (GH1870, GH13695, GH13709, GH13902). Full documentation is here. 1.6. v0.19.0 (October 2, 2016) 53 pandas: powerful Python data analysis toolkit, Release 0.20.3 The merge_asof() performs an asof merge0 码力 | 2045 页 | 9.18 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 0.20.2openpyxl engine. (GH15530) For example, after running the following, styled.xlsx renders as below: In [53]: np.random.seed(24) In [54]: df = pd.DataFrame({'A': np.linspace(1, 10, 10)}) In [55]: df = pd.concat([df except that forward filling happens automatically taking the most recent 1.5. v0.19.0 (October 2, 2016) 53 pandas: powerful Python data analysis toolkit, Release 0.20.2 non-NaN value. In [11]: pd.merge_asof(trades Index(['a', nan, 'c'], dtype='object') Index now supports .dropna() to exclude missing values (GH6194) In [53]: idx = pd.Index([1, 2, np.nan, 4]) In [54]: idx.dropna() Out[54]: Float64Index([1.0, 2.0, 4.0], dtype='float64')0 码力 | 1907 页 | 7.83 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 0.15day, 19:04:00 STD> You can also chain these types of operations: In [53]: s.dt.tz_localize(’UTC’).dt.tz_convert(’US/Eastern’) Out[53]: 0 2013-01-01 04:10:12-05:00 1 2013-01-02 04:10:12-05:00 2 2013-01-03 2], [1, 4], [5, 6]], columns=[’A’, ’B’]) In [23]: g = df.groupby(’A’) 1.5. v0.14.0 (May 31 , 2014) 53 pandas: powerful Python data analysis toolkit, Release 0.15.2 In [24]: g.head(1) # filters DataFrame len(columns))), ....: index=index, ....: columns=columns).sortlevel().sortlevel(axis=1) ....: In [53]: df Out[53]: lvl0 a b lvl1 bar foo bah foo A0 B0 C0 D0 1 0 3 2 D1 5 4 7 6 C1 D0 9 8 11 10 D1 13 120 码力 | 1579 页 | 9.15 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 0.15.1day, 19:04:00 STD> You can also chain these types of operations: In [53]: s.dt.tz_localize(’UTC’).dt.tz_convert(’US/Eastern’) Out[53]: 0 2013-01-01 04:10:12-05:00 1 2013-01-02 04:10:12-05:00 2 2013-01-03 len(columns))), ....: index=index, ....: columns=columns).sortlevel().sortlevel(axis=1) ....: In [53]: df Out[53]: lvl0 a b lvl1 bar foo bah foo A0 B0 C0 D0 1 0 3 2 D1 5 4 7 6 C1 D0 9 8 11 10 D1 13 12 lvl0 a b lvl1 foo foo B0 C0 D0 64 66 D1 68 70 C1 D0 72 74 D1 76 78 1.4. v0.14.0 (May 31 , 2014) 53 pandas: powerful Python data analysis toolkit, Release 0.15.1 C2 D0 80 82 D1 84 86 C3 D0 88 900 码力 | 1557 页 | 9.10 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 0.19.1. . . . . . . . . . . . . . . . . . . . . . . . . . 53 .groupby(..).nth() changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 numpy function compatibility . . . . . . . . . . . nan, u'c'], dtype='object') Index now supports .dropna() to exclude missing values (GH6194) In [53]: idx = pd.Index([1, 2, np.nan, 4]) In [54]: idx.dropna() Out[54]: Float64Index([1.0, 2.0, 4.0], dtype='float64') as_index=False)['B'].nth(0) Out[4]: 0 1 1 2 Name: B, dtype: int64 New Behavior: 1.3. v0.18.1 (May 3, 2016) 53 pandas: powerful Python data analysis toolkit, Release 0.19.1 In [43]: df.groupby('A', as_index=True)['B']0 码力 | 1943 页 | 12.06 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 0.19.052 numpy function compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Using .apply on groupby resampling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 Changes nan, u'c'], dtype='object') Index now supports .dropna() to exclude missing values (GH6194) In [53]: idx = pd.Index([1, 2, np.nan, 4]) In [54]: idx.dropna() Out[54]: Float64Index([1.0, 2.0, 4.0], dtype='float64') (GH12238) • Bug in numpy compatibility of np.round() on a Series (GH12600) 1.2. v0.18.1 (May 3, 2016) 53 pandas: powerful Python data analysis toolkit, Release 0.19.0 An example of this signature augmentation0 码力 | 1937 页 | 12.03 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 0.17.0analysis toolkit, Release 0.17.0 The take_last keyword is deprecated, see here (GH6511, GH8505) In [53]: s = pd.Series(['A', 'B', 'C', 'A', 'B', 'D']) In [54]: s.drop_duplicates() Out[54]: 0 A 1 B 2 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78 00:00:00-05:00'], dtype='datetime64[ns, US/Eastern]', name=u'foo', freq='D') In [53]: pd.date_range('20130101',periods=25, freq='D') Out[53]: DatetimeIndex(['2013-01-01', '2013-01-02', '2013-01-03', '2013-01-04'0 码力 | 1787 页 | 10.76 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 0.14.0len(columns))), ....: index=index, ....: columns=columns).sortlevel().sortlevel(axis=1) ....: In [53]: df Out[53]: lvl0 a b lvl1 bar foo bah foo A0 B0 C0 D0 1 0 3 2 D1 5 4 7 6 C1 D0 9 8 11 10 D1 13 12 363770 0.013169 0.392036 -1.123913 [5 rows x 4 columns] This is equivalent to the following In [53]: result = Panel(dict([ (ax,f(panel.loc[:,:,ax])) ....: for ax in panel.minor_axis ])) ....: In [50]: path = ’test.h5’ In [51]: df = DataFrame(randn(10,2)) In [52]: store1 = HDFStore(path) In [53]: store2 = HDFStore(path) In [54]: store1.append(’df’,df) In [55]: store2.append(’df2’,df) 1.3.0 码力 | 1349 页 | 7.67 MB | 1 年前3
共 32 条
- 1
- 2
- 3
- 4













