pandas: powerful Python data analysis toolkit - 0.25default integer index: In [3]: s = pd.Series([1, 3, 5, np.nan, 6, 8]) In [4]: s Out[4]: 0 1.0 1 3.0 2 5.0 3 NaN 4 6.0 5 8.0 dtype: float64 Creating a DataFrame by passing a NumPy array, with a 437482 5 1.0 2013-01-03 -1.323650 0.427355 0.835343 5 2.0 2013-01-04 0.509859 -2.769586 1.000521 5 3.0 2013-01-05 0.139488 -0.259328 1.082034 5 4.0 2013-01-06 -0.130327 -0.372906 1.072236 5 5.0 A where -1.0 2013-01-03 -1.323650 -0.427355 -0.835343 -5 -2.0 2013-01-04 -0.509859 -2.769586 -1.000521 -5 -3.0 2013-01-05 -0.139488 -0.259328 -1.082034 -5 -4.0 2013-01-06 -0.130327 -0.372906 -1.072236 -5 -5.00 码力 | 698 页 | 4.91 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 0.20.3A B C D E 0 1.0 1.329212 NaN -0.316280 -0.990810 1 2.0 -1.070816 -1.438713 0.564417 0.295722 2 3.0 -1.626404 0.219565 0.678805 1.889273 3 4.0 0.961538 0.104011 -0.481165 0.850229 4 5.0 1.453425 1 bins=2) In [61]: c Out[61]: [(-0.003, 1.5], (-0.003, 1.5], (1.5, 3.0], (1.5, 3.0]] Categories (2, interval[float64]): [(-0.003, 1.5] < (1.5, 3.0]] In [62]: c.categories \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\Out[62]: ˓→ IntervalIndex([(-0.003, 1.5], (1.5, 3.0]] closed='right', dtype='interval[float64]') Furthermore, this allows one to bin other data with0 码力 | 2045 页 | 9.18 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 0.20.2A B C D E 0 1.0 1.329212 NaN -0.316280 -0.990810 1 2.0 -1.070816 -1.438713 0.564417 0.295722 2 3.0 -1.626404 0.219565 0.678805 1.889273 3 4.0 0.961538 0.104011 -0.481165 0.850229 4 5.0 1.453425 1 bins=2) In [61]: c Out[61]: [(-0.003, 1.5], (-0.003, 1.5], (1.5, 3.0], (1.5, 3.0]] Categories (2, interval[float64]): [(-0.003, 1.5] < (1.5, 3.0]] 1.2. v0.20.1 (May 5, 2017) 17 pandas: powerful Python data \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\Out[62]: ˓→ IntervalIndex([(-0.003, 1.5], (1.5, 3.0]] closed='right', dtype='interval[float64]') Furthermore, this allows one to bin other data with0 码力 | 1907 页 | 7.83 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 0.19.0pandas: powerful Python data analysis toolkit, Release 0.19.0 a left_val right_val 0 1 a NaN 1 5 b 3.0 2 10 c 7.0 In a typical time-series example, we have trades and quotes and we want to asof-join them rolling(2).sum() Out[14]: B 2013-01-01 09:00:00 NaN 2013-01-01 09:00:01 1.0 2013-01-01 09:00:02 3.0 2013-01-01 09:00:03 NaN 2013-01-01 09:00:04 NaN In [15]: dft.rolling(2, min_periods=1).sum() 1 Release 0.19.0 Out[15]: B 2013-01-01 09:00:00 0.0 2013-01-01 09:00:01 1.0 2013-01-01 09:00:02 3.0 2013-01-01 09:00:03 2.0 2013-01-01 09:00:04 4.0 Specifying an offset allows a more intuitive specification0 码力 | 1937 页 | 12.03 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 0.19.1merge_asof(left, right, on='a', allow_exact_matches=False) Out[6]: a left_val right_val 0 1 a NaN 1 5 b 3.0 2 10 c 7.0 In a typical time-series example, we have trades and quotes and we want to asof-join them 09:00:02 3.0 2013-01-01 09:00:03 NaN 2013-01-01 09:00:04 NaN In [15]: dft.rolling(2, min_periods=1).sum() Out[15]: B 2013-01-01 09:00:00 0.0 2013-01-01 09:00:01 1.0 2013-01-01 09:00:02 3.0 2013-01-01 rolling('2s').sum() Out[16]: B 2013-01-01 09:00:00 0.0 2013-01-01 09:00:01 1.0 2013-01-01 09:00:02 3.0 2013-01-01 09:00:03 2.0 2013-01-01 09:00:04 4.0 Using a non-regular, but still monotonic index,0 码力 | 1943 页 | 12.06 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 0.21.1(October 27, 2017) 9 pandas: powerful Python data analysis toolkit, Release 0.21.1 0 1.0 1 2.0 2 3.0 Setting a list-like data structure into a new attribute now raises a UserWarning about the potential Out[37]: 0 1 1 2 2 3 dtype: int64 Previous Behavior In [4]: s.loc[[1, 2, 3]] Out[4]: 1 2.0 2 3.0 3 NaN dtype: float64 Current Behavior In [4]: s.loc[[1, 2, 3]] Passing list-likes to .loc or [] http://pandas.pydata.org/pandas-docs/stable/indexing.html#deprecate-loc-reindex- ˓→listlike Out[4]: 1 2.0 2 3.0 3 NaN dtype: float64 The idiomatic way to achieve selecting potentially not-found elements is via0 码力 | 2207 页 | 8.59 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 0.25.1default integer index: In [3]: s = pd.Series([1, 3, 5, np.nan, 6, 8]) In [4]: s Out[4]: 0 1.0 1 3.0 2 5.0 3 NaN 4 6.0 5 8.0 dtype: float64 Creating a DataFrame by passing a NumPy array, with a 226064 5 1.0 2013-01-03 -0.136964 -0.276600 -0.614256 5 2.0 2013-01-04 0.066430 0.886690 1.544564 5 3.0 2013-01-05 0.996132 0.368752 1.232876 5 4.0 2013-01-06 -0.827664 0.620576 -0.247042 5 5.0 A where -1.0 2013-01-03 -0.136964 -0.276600 -0.614256 -5 -2.0 2013-01-04 -0.066430 -0.886690 -1.544564 -5 -3.0 2013-01-05 -0.996132 -0.368752 -1.232876 -5 -4.0 2013-01-06 -0.827664 -0.620576 -0.247042 -5 -5.00 码力 | 2833 页 | 9.65 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 0.25.0default integer index: In [3]: s = pd.Series([1, 3, 5, np.nan, 6, 8]) In [4]: s Out[4]: 0 1.0 1 3.0 2 5.0 3 NaN 4 6.0 5 8.0 dtype: float64 Creating a DataFrame by passing a NumPy array, with a 446934 5 1.0 2013-01-03 -0.918029 -1.032644 1.599718 5 2.0 2013-01-04 -1.236791 -0.438204 0.101452 5 3.0 2013-01-05 -1.632181 -0.992838 0.741029 5 4.0 2013-01-06 0.017195 -1.035754 0.960719 5 5.0 A where -1.0 2013-01-03 -0.918029 -1.032644 -1.599718 -5 -2.0 2013-01-04 -1.236791 -0.438204 -0.101452 -5 -3.0 2013-01-05 -1.632181 -0.992838 -0.741029 -5 -4.0 2013-01-06 -0.017195 -1.035754 -0.960719 -5 -5.00 码力 | 2827 页 | 9.62 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 1.0.0default integer index: In [3]: s = pd.Series([1, 3, 5, np.nan, 6, 8]) In [4]: s Out[4]: 0 1.0 1 3.0 2 5.0 3 NaN 4 6.0 5 8.0 dtype: float64 Creating a DataFrame by passing a NumPy array, with a 419296 5 1.0 2013-01-03 1.789156 0.984494 1.794371 5 2.0 2013-01-04 0.743967 -0.470009 -1.308438 5 3.0 2013-01-05 0.969829 -0.538649 -0.384829 5 4.0 2013-01-06 0.101131 0.852161 0.004849 5 5.0 A where -1.0 2013-01-03 -1.789156 -0.984494 -1.794371 -5 -2.0 2013-01-04 -0.743967 -0.470009 -1.308438 -5 -3.0 2013-01-05 -0.969829 -0.538649 -0.384829 -5 -4.0 2013-01-06 -0.101131 -0.852161 -0.004849 -5 -5.00 码力 | 3015 页 | 10.78 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 0.24.0__git_version__ will return git commit sha of current build (GH21295). • Compatibility with Matplotlib 3.0 (GH22790). • Added Interval.overlaps(), arrays.IntervalArray.overlaps(), and IntervalIndex. overlaps() default integer index: In [3]: s = pd.Series([1, 3, 5, np.nan, 6, 8]) In [4]: s Out[4]: 0 1.0 1 3.0 2 5.0 3 NaN 4 6.0 5 8.0 dtype: float64 Creating a DataFrame by passing a NumPy array, with a 590397 5 1.0 2013-01-03 -0.238464 -0.486944 0.015596 5 2.0 2013-01-04 -0.274925 0.823338 -0.761681 5 3.0 2013-01-05 1.092525 1.164866 -0.846108 5 4.0 2013-01-06 1.001105 0.071785 -1.067411 5 5.0 A where0 码力 | 2973 页 | 9.90 MB | 1 年前3
共 32 条
- 1
- 2
- 3
- 4













