pandas: powerful Python data analysis toolkit - 0.24.0Out[16]:['2000-01-01', '2000-01-02', '2000-01-03', '2000-01-04'] Length: 4, dtype: period[D] In [17]: pd.Series(idx).array \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ˓→ ['2000-01-01', '2000-01-02', '2000-01-03', '2000-01-04'] Length: 4, dtype: period[D] Historically, this would have been done with series.values, but with .values it was unclear whether In [18]: idx.values Out[18]: array([Period('2000-01-01', 'D'), Period('2000-01-02', 'D'), Period('2000-01-03', 'D'), Period('2000-01-04', 'D')], dtype=object) In [19]: id(idx.values) \\\\\\\\\\\\\\\ 0 码力 | 2973 页 | 9.90 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 0.7.2Dimen- sions Name Description 1 Series 1D labeled homogeneously-typed array 1 Time- Series Series with index containing datetimes 2 DataFrame General 2D labeled, size-mutable tabular structure with with potentially heterogeneously-typed columns 3 Panel General 3D labeled, also size-mutable array 4.1.1 Why more than 1 data structure? The best way to think about the pandas data structures is as flexible ’c’, ’d’, ’e’]) In [229]: s Out[229]: 23 pandas: powerful Python data analysis toolkit, Release 0.7.2 a -0.284 b -1.537 c 0.163 d -0.648 e -1.703 In [230]: s.index Out[230]: Index([a, b, c, d, e]0 码力 | 283 页 | 1.45 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 0.7.1Dimen- sions Name Description 1 Series 1D labeled homogeneously-typed array 1 Time- Series Series with index containing datetimes 2 DataFrame General 2D labeled, size-mutable tabular structure with with potentially heterogeneously-typed columns 3 Panel General 3D labeled, also size-mutable array 4.1.1 Why more than 1 data structure? The best way to think about the pandas data structures is as flexible ’c’, ’d’, ’e’]) In [229]: s Out[229]: 23 pandas: powerful Python data analysis toolkit, Release 0.7.1 a -0.284 b -1.537 c 0.163 d -0.648 e -1.703 In [230]: s.index Out[230]: Index([a, b, c, d, e]0 码力 | 281 页 | 1.45 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 0.7.3...: ’two’, ’two’, ’one’, ’three’], .....: ’C’ : np.random.randn(8), ’D’ : np.random.randn(8)}) In [929]: df Out[929]: A B C D 0 foo one -0.541264 2.801614 1 bar one -0.722290 1.669853 2 foo two Dimen- sions Name Description 1 Series 1D labeled homogeneously-typed array 1 Time- Series Series with index containing datetimes 2 DataFrame General 2D labeled, size-mutable tabular structure with with potentially heterogeneously-typed columns 3 Panel General 3D labeled, also size-mutable array 4.1.1 Why more than 1 data structure? The best way to think about the pandas data structures is as flexible0 码力 | 297 页 | 1.92 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 0.25.1Python version will be bumped to 3.6 in a future release. Warning: Panel has been fully removed. For N-D labeled data structures, please use xarray Warning: read_pickle() and read_msgpack() are only guaranteed = pd.DataFrame([{'var1': 'a,b,c', 'var2': 1}, ....: {'var1': 'd,e,f', 'var2': 2}]) ....: In [13]: df Out[13]: var1 var2 0 a,b,c 1 1 d,e,f 2 [2 rows x 2 columns] Creating a long form DataFrame is df.assign(var1=df.var1.str.split(',')).explode('var1') Out[14]: var1 var2 0 a 1 0 b 1 0 c 1 1 d 2 1 e 2 1 f 2 [6 rows x 2 columns] 1.1.7 Other enhancements • DataFrame.plot() keywords logy, logx0 码力 | 2833 页 | 9.65 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 0.25.0Python version will be bumped to 3.6 in a future release. Warning: Panel has been fully removed. For N-D labeled data structures, please use xarray Warning: read_pickle() and read_msgpack() are only guaranteed = pd.DataFrame([{'var1': 'a,b,c', 'var2': 1}, ....: {'var1': 'd,e,f', 'var2': 2}]) ....: In [13]: df Out[13]: var1 var2 0 a,b,c 1 1 d,e,f 2 [2 rows x 2 columns] Creating a long form DataFrame is df.assign(var1=df.var1.str.split(',')).explode('var1') Out[14]: var1 var2 0 a 1 0 b 1 0 c 1 1 d 2 1 e 2 1 f 2 [6 rows x 2 columns] 1.1.7 Other enhancements • DataFrame.plot() keywords logy, logx0 码力 | 2827 页 | 9.62 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 1.0.0columns] pandas 0.25.x >>> df.resample("2D").agg(lambda x: 'a').A.dtype CategoricalDtype(categories=['a', 'b'], ordered=False) pandas 1.0.0 In [50]: df.resample("2D").agg(lambda x: 'a').A.dtype Out[50]: cast back to the original dtype. pandas 0.25.x >>> df.resample("2D").agg(lambda x: 'c') A 0 NaN pandas 1.0.0 In [51]: df.resample("2D").agg(lambda x: 'c') Out[51]: A 2000-01-01 c [1 rows x 1 columns] tuple of Series (GH28410) • Fix corrupted error message when calling pandas.libs._json.encode() on a 0d array (GH18878) • Backtick quoting in DataFrame.query() and DataFrame.eval() can now also be used to0 码力 | 3015 页 | 10.78 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 1.1.0applications. Data structures Dimensions Name Description 1 Series 1D labeled homogeneously-typed array 2 DataFrame General 2D labeled, size-mutable tabular structure with potentially heterogeneously-typed 3 Andersson, Mr. Anders Johan ˓→ male 39.0 1 5 347082 31.2750 NaN S 15 16 1 2 Hewlett, Mrs. (Mary D Kingcome) ˓→female 55.0 0 0 248706 16.0000 NaN S To select rows based on a conditional expression Mr. Timothy J 11 Bonnell, Miss. Elizabeth 13 Andersson, Mr. Anders Johan 15 Hewlett, Mrs. (Mary D Kingcome) Name: Name, dtype: object In this case, a subset of both rows and columns is made in one0 码力 | 3229 页 | 10.87 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 1.1.1applications. Data structures Dimensions Name Description 1 Series 1D labeled homogeneously-typed array 2 DataFrame General 2D labeled, size-mutable tabular structure with potentially heterogeneously-typed 0 3 Andersson, Mr. Anders Johan ˓→ male ... 5 347082 31.2750 NaN S 15 16 1 2 Hewlett, Mrs. (Mary D Kingcome) ˓→female ... 0 248706 16.0000 NaN S [5 rows x 12 columns] To select rows based on a conditional Mr. Timothy J 11 Bonnell, Miss. Elizabeth 13 Andersson, Mr. Anders Johan 15 Hewlett, Mrs. (Mary D Kingcome) Name: Name, dtype: object In this case, a subset of both rows and columns is made in one0 码力 | 3231 页 | 10.87 MB | 1 年前3
pandas: powerful Python data analysis toolkit -1.0.3applications. Data structures Dimensions Name Description 1 Series 1D labeled homogeneously-typed array 2 DataFrame General 2D labeled, size-mutable tabular structure with potentially heterogeneously-typed '2013-01-06'], dtype='datetime64[ns]', freq='D') In [7]: df = pd.DataFrame(np.random.randn(6, 4), index=dates, columns=list('ABCD')) In [8]: df Out[8]: A B C D 2013-01-01 0.537250 -0.315005 -0.935783 1 dtype='float32'), ...: 'D': np.array([3] * 4, dtype='int32'), ...: 'E': pd.Categorical(["test", "train", "test", "train"]), ...: 'F': 'foo'}) ...: In [10]: df2 Out[10]: A B C D E F 0 1.0 2013-01-020 码力 | 3071 页 | 10.10 MB | 1 年前3
共 32 条
- 1
- 2
- 3
- 4













