 pandas: powerful Python data analysis toolkit - 0.25835343 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 operation with setting. In [52]: df2 = df -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 22 Chapter 3. Getting started pandas: powerful Python 2013-01-01 NaN NaN NaN NaN NaN 2013-01-02 NaN NaN NaN NaN NaN 2013-01-03 -2.323650 -0.572645 -0.164657 4.0 1.0 2013-01-04 -2.490141 -5.769586 -1.999479 2.0 0.0 2013-01-05 -4.860512 -5.259328 -3.917966 0.0 -10 码力 | 698 页 | 4.91 MB | 1 年前3 pandas: powerful Python data analysis toolkit - 0.25835343 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 operation with setting. In [52]: df2 = df -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 22 Chapter 3. Getting started pandas: powerful Python 2013-01-01 NaN NaN NaN NaN NaN 2013-01-02 NaN NaN NaN NaN NaN 2013-01-03 -2.323650 -0.572645 -0.164657 4.0 1.0 2013-01-04 -2.490141 -5.769586 -1.999479 2.0 0.0 2013-01-05 -4.860512 -5.259328 -3.917966 0.0 -10 码力 | 698 页 | 4.91 MB | 1 年前3
 pandas: powerful Python data analysis toolkit - 1.4.295 5.0 55.0 99 5.0 55.0 2 95 7.0 77.0 99 NaN NaN big damp 3.0 33.0 blue dry 3.0 33.0 red red 4.0 44.0 wet 1.0 11.0 For more details and examples see the groupby documentation. 1.4. Tutorials 65 for x, val in np.ndenumerate(a)]) Out[29]: 0 1 2 3 0 0 0 0 1.0 1 0 0 1 2.0 2 0 0 2 3.0 3 0 0 3 4.0 4 0 1 0 5.0 .. .. .. .. ... 19 1 1 3 20.0 20 1 2 0 21.0 21 1 2 1 22.0 22 1 2 2 23.0 23 1 2 3 range(1, 5)) + [np.NAN])) In [31]: pd.DataFrame(a) Out[31]: 0 1 0 0 1.0 1 1 2.0 2 2 3.0 3 3 4.0 4 4 NaN For more details and examples see the Into to Data Structures documentation. meltdf An0 码力 | 3739 页 | 15.24 MB | 1 年前3 pandas: powerful Python data analysis toolkit - 1.4.295 5.0 55.0 99 5.0 55.0 2 95 7.0 77.0 99 NaN NaN big damp 3.0 33.0 blue dry 3.0 33.0 red red 4.0 44.0 wet 1.0 11.0 For more details and examples see the groupby documentation. 1.4. Tutorials 65 for x, val in np.ndenumerate(a)]) Out[29]: 0 1 2 3 0 0 0 0 1.0 1 0 0 1 2.0 2 0 0 2 3.0 3 0 0 3 4.0 4 0 1 0 5.0 .. .. .. .. ... 19 1 1 3 20.0 20 1 2 0 21.0 21 1 2 1 22.0 22 1 2 2 23.0 23 1 2 3 range(1, 5)) + [np.NAN])) In [31]: pd.DataFrame(a) Out[31]: 0 1 0 0 1.0 1 1 2.0 2 2 3.0 3 3 4.0 4 4 NaN For more details and examples see the Into to Data Structures documentation. meltdf An0 码力 | 3739 页 | 15.24 MB | 1 年前3
 pandas: powerful Python data analysis toolkit - 1.4.495 5.0 55.0 99 5.0 55.0 2 95 7.0 77.0 99 NaN NaN big damp 3.0 33.0 blue dry 3.0 33.0 red red 4.0 44.0 wet 1.0 11.0 For more details and examples see the groupby documentation. 1.4. Tutorials 65 for x, val in np.ndenumerate(a)]) Out[29]: 0 1 2 3 0 0 0 0 1.0 1 0 0 1 2.0 2 0 0 2 3.0 3 0 0 3 4.0 4 0 1 0 5.0 .. .. .. .. ... 19 1 1 3 20.0 20 1 2 0 21.0 21 1 2 1 22.0 22 1 2 2 23.0 23 1 2 3 range(1, 5)) + [np.NAN])) In [31]: pd.DataFrame(a) Out[31]: 0 1 0 0 1.0 1 1 2.0 2 2 3.0 3 3 4.0 4 4 NaN For more details and examples see the Into to Data Structures documentation. meltdf An0 码力 | 3743 页 | 15.26 MB | 1 年前3 pandas: powerful Python data analysis toolkit - 1.4.495 5.0 55.0 99 5.0 55.0 2 95 7.0 77.0 99 NaN NaN big damp 3.0 33.0 blue dry 3.0 33.0 red red 4.0 44.0 wet 1.0 11.0 For more details and examples see the groupby documentation. 1.4. Tutorials 65 for x, val in np.ndenumerate(a)]) Out[29]: 0 1 2 3 0 0 0 0 1.0 1 0 0 1 2.0 2 0 0 2 3.0 3 0 0 3 4.0 4 0 1 0 5.0 .. .. .. .. ... 19 1 1 3 20.0 20 1 2 0 21.0 21 1 2 1 22.0 22 1 2 2 23.0 23 1 2 3 range(1, 5)) + [np.NAN])) In [31]: pd.DataFrame(a) Out[31]: 0 1 0 0 1.0 1 1 2.0 2 2 3.0 3 3 4.0 4 4 NaN For more details and examples see the Into to Data Structures documentation. meltdf An0 码力 | 3743 页 | 15.26 MB | 1 年前3
 pandas: powerful Python data analysis toolkit - 1.3.395 5.0 55.0 99 5.0 55.0 2 95 7.0 77.0 99 NaN NaN big damp 3.0 33.0 blue dry 3.0 33.0 red red 4.0 44.0 wet 1.0 11.0 For more details and examples see the groupby documentation. 1.4. Tutorials 65 for x, val in np.ndenumerate(a)]) Out[29]: 0 1 2 3 0 0 0 0 1.0 1 0 0 1 2.0 2 0 0 2 3.0 3 0 0 3 4.0 4 0 1 0 5.0 .. .. .. .. ... 19 1 1 3 20.0 20 1 2 0 21.0 21 1 2 1 22.0 22 1 2 2 23.0 23 1 2 3 range(1, 5)) + [np.NAN])) In [31]: pd.DataFrame(a) Out[31]: 0 1 0 0 1.0 1 1 2.0 2 2 3.0 3 3 4.0 4 4 NaN For more details and examples see the Into to Data Structures documentation. melt.data.frame0 码力 | 3603 页 | 14.65 MB | 1 年前3 pandas: powerful Python data analysis toolkit - 1.3.395 5.0 55.0 99 5.0 55.0 2 95 7.0 77.0 99 NaN NaN big damp 3.0 33.0 blue dry 3.0 33.0 red red 4.0 44.0 wet 1.0 11.0 For more details and examples see the groupby documentation. 1.4. Tutorials 65 for x, val in np.ndenumerate(a)]) Out[29]: 0 1 2 3 0 0 0 0 1.0 1 0 0 1 2.0 2 0 0 2 3.0 3 0 0 3 4.0 4 0 1 0 5.0 .. .. .. .. ... 19 1 1 3 20.0 20 1 2 0 21.0 21 1 2 1 22.0 22 1 2 2 23.0 23 1 2 3 range(1, 5)) + [np.NAN])) In [31]: pd.DataFrame(a) Out[31]: 0 1 0 0 1.0 1 1 2.0 2 2 3.0 3 3 4.0 4 4 NaN For more details and examples see the Into to Data Structures documentation. melt.data.frame0 码力 | 3603 页 | 14.65 MB | 1 年前3
 pandas: powerful Python data analysis toolkit - 1.3.495 5.0 55.0 99 5.0 55.0 2 95 7.0 77.0 99 NaN NaN big damp 3.0 33.0 blue dry 3.0 33.0 red red 4.0 44.0 wet 1.0 11.0 For more details and examples see the groupby documentation. match / %in% A common for x, val in np.ndenumerate(a)]) Out[29]: 0 1 2 3 0 0 0 0 1.0 1 0 0 1 2.0 2 0 0 2 3.0 3 0 0 3 4.0 4 0 1 0 5.0 .. .. .. .. ... 19 1 1 3 20.0 20 1 2 0 21.0 21 1 2 1 22.0 22 1 2 2 23.0 23 1 2 3 range(1, 5)) + [np.NAN])) In [31]: pd.DataFrame(a) Out[31]: 0 1 0 0 1.0 1 1 2.0 2 2 3.0 3 3 4.0 4 4 NaN For more details and examples see the Into to Data Structures documentation. 70 Chapter0 码力 | 3605 页 | 14.68 MB | 1 年前3 pandas: powerful Python data analysis toolkit - 1.3.495 5.0 55.0 99 5.0 55.0 2 95 7.0 77.0 99 NaN NaN big damp 3.0 33.0 blue dry 3.0 33.0 red red 4.0 44.0 wet 1.0 11.0 For more details and examples see the groupby documentation. match / %in% A common for x, val in np.ndenumerate(a)]) Out[29]: 0 1 2 3 0 0 0 0 1.0 1 0 0 1 2.0 2 0 0 2 3.0 3 0 0 3 4.0 4 0 1 0 5.0 .. .. .. .. ... 19 1 1 3 20.0 20 1 2 0 21.0 21 1 2 1 22.0 22 1 2 2 23.0 23 1 2 3 range(1, 5)) + [np.NAN])) In [31]: pd.DataFrame(a) Out[31]: 0 1 0 0 1.0 1 1 2.0 2 2 3.0 3 3 4.0 4 4 NaN For more details and examples see the Into to Data Structures documentation. 70 Chapter0 码力 | 3605 页 | 14.68 MB | 1 年前3
 pandas: powerful Python data analysis toolkit - 1.3.295 5.0 55.0 99 5.0 55.0 2 95 7.0 77.0 99 NaN NaN big damp 3.0 33.0 blue dry 3.0 33.0 red red 4.0 44.0 wet 1.0 11.0 For more details and examples see the groupby documentation. match / %in% A common for x, val in np.ndenumerate(a)]) Out[29]: 0 1 2 3 0 0 0 0 1.0 1 0 0 1 2.0 2 0 0 2 3.0 3 0 0 3 4.0 4 0 1 0 5.0 .. .. .. .. ... 19 1 1 3 20.0 20 1 2 0 21.0 21 1 2 1 22.0 22 1 2 2 23.0 23 1 2 3 range(1, 5)) + [np.NAN])) In [31]: pd.DataFrame(a) Out[31]: 0 1 0 0 1.0 1 1 2.0 2 2 3.0 3 3 4.0 4 4 NaN For more details and examples see the Into to Data Structures documentation. 1.4. Tutorials0 码力 | 3509 页 | 14.01 MB | 1 年前3 pandas: powerful Python data analysis toolkit - 1.3.295 5.0 55.0 99 5.0 55.0 2 95 7.0 77.0 99 NaN NaN big damp 3.0 33.0 blue dry 3.0 33.0 red red 4.0 44.0 wet 1.0 11.0 For more details and examples see the groupby documentation. match / %in% A common for x, val in np.ndenumerate(a)]) Out[29]: 0 1 2 3 0 0 0 0 1.0 1 0 0 1 2.0 2 0 0 2 3.0 3 0 0 3 4.0 4 0 1 0 5.0 .. .. .. .. ... 19 1 1 3 20.0 20 1 2 0 21.0 21 1 2 1 22.0 22 1 2 2 23.0 23 1 2 3 range(1, 5)) + [np.NAN])) In [31]: pd.DataFrame(a) Out[31]: 0 1 0 0 1.0 1 1 2.0 2 2 3.0 3 3 4.0 4 4 NaN For more details and examples see the Into to Data Structures documentation. 1.4. Tutorials0 码力 | 3509 页 | 14.01 MB | 1 年前3
 pandas: powerful Python data analysis toolkit - 1.5.0rc095 5.0 55.0 99 5.0 55.0 2 95 7.0 77.0 99 NaN NaN big damp 3.0 33.0 blue dry 3.0 33.0 red red 4.0 44.0 wet 1.0 11.0 For more details and examples see the groupby documentation. 66 Chapter 1. Getting for x, val in np.ndenumerate(a)]) Out[29]: 0 1 2 3 0 0 0 0 1.0 1 0 0 1 2.0 2 0 0 2 3.0 3 0 0 3 4.0 4 0 1 0 5.0 .. .. .. .. ... 19 1 1 3 20.0 20 1 2 0 21.0 21 1 2 1 22.0 22 1 2 2 23.0 23 1 2 3 range(1, 5)) + [np.NAN])) In [31]: pd.DataFrame(a) Out[31]: 0 1 0 0 1.0 1 1 2.0 2 2 3.0 3 3 4.0 4 4 NaN For more details and examples see the Into to Data Structures documentation. meltdf An0 码力 | 3943 页 | 15.73 MB | 1 年前3 pandas: powerful Python data analysis toolkit - 1.5.0rc095 5.0 55.0 99 5.0 55.0 2 95 7.0 77.0 99 NaN NaN big damp 3.0 33.0 blue dry 3.0 33.0 red red 4.0 44.0 wet 1.0 11.0 For more details and examples see the groupby documentation. 66 Chapter 1. Getting for x, val in np.ndenumerate(a)]) Out[29]: 0 1 2 3 0 0 0 0 1.0 1 0 0 1 2.0 2 0 0 2 3.0 3 0 0 3 4.0 4 0 1 0 5.0 .. .. .. .. ... 19 1 1 3 20.0 20 1 2 0 21.0 21 1 2 1 22.0 22 1 2 2 23.0 23 1 2 3 range(1, 5)) + [np.NAN])) In [31]: pd.DataFrame(a) Out[31]: 0 1 0 0 1.0 1 1 2.0 2 2 3.0 3 3 4.0 4 4 NaN For more details and examples see the Into to Data Structures documentation. meltdf An0 码力 | 3943 页 | 15.73 MB | 1 年前3
 pandas: powerful Python data analysis toolkit - 1.1.195 5.0 55.0 99 5.0 55.0 2 95 7.0 77.0 99 NaN NaN big damp 3.0 33.0 blue dry 3.0 33.0 red red 4.0 44.0 wet 1.0 11.0 For more details and examples see the groupby documentation. match / %in% A common for x, val in np.ndenumerate(a)]) Out[29]: 0 1 2 3 0 0 0 0 1.0 1 0 0 1 2.0 2 0 0 2 3.0 3 0 0 3 4.0 4 0 1 0 5.0 .. .. .. .. ... 19 1 1 3 20.0 20 1 2 0 21.0 21 1 2 1 22.0 22 1 2 2 23.0 23 1 2 3 range(1, 5)) + [np.NAN])) In [31]: pd.DataFrame(a) Out[31]: 0 1 0 0 1.0 1 1 2.0 2 2 3.0 3 3 4.0 4 4 NaN For more details and examples see the Into to Data Structures documentation. melt.data.frame0 码力 | 3231 页 | 10.87 MB | 1 年前3 pandas: powerful Python data analysis toolkit - 1.1.195 5.0 55.0 99 5.0 55.0 2 95 7.0 77.0 99 NaN NaN big damp 3.0 33.0 blue dry 3.0 33.0 red red 4.0 44.0 wet 1.0 11.0 For more details and examples see the groupby documentation. match / %in% A common for x, val in np.ndenumerate(a)]) Out[29]: 0 1 2 3 0 0 0 0 1.0 1 0 0 1 2.0 2 0 0 2 3.0 3 0 0 3 4.0 4 0 1 0 5.0 .. .. .. .. ... 19 1 1 3 20.0 20 1 2 0 21.0 21 1 2 1 22.0 22 1 2 2 23.0 23 1 2 3 range(1, 5)) + [np.NAN])) In [31]: pd.DataFrame(a) Out[31]: 0 1 0 0 1.0 1 1 2.0 2 2 3.0 3 3 4.0 4 4 NaN For more details and examples see the Into to Data Structures documentation. melt.data.frame0 码力 | 3231 页 | 10.87 MB | 1 年前3
 pandas: powerful Python data analysis toolkit - 1.1.095 5.0 55.0 99 5.0 55.0 2 95 7.0 77.0 99 NaN NaN big damp 3.0 33.0 blue dry 3.0 33.0 red red 4.0 44.0 wet 1.0 11.0 For more details and examples see the groupby documentation. match / %in% A common for x, val in np.ndenumerate(a)]) Out[29]: 0 1 2 3 0 0 0 0 1.0 1 0 0 1 2.0 2 0 0 2 3.0 3 0 0 3 4.0 4 0 1 0 5.0 .. .. .. .. ... 19 1 1 3 20.0 20 1 2 0 21.0 21 1 2 1 22.0 22 1 2 2 23.0 23 1 2 3 range(1, 5)) + [np.NAN])) In [31]: pd.DataFrame(a) Out[31]: 0 1 0 0 1.0 1 1 2.0 2 2 3.0 3 3 4.0 4 4 NaN For more details and examples see the Into to Data Structures documentation. melt.data.frame0 码力 | 3229 页 | 10.87 MB | 1 年前3 pandas: powerful Python data analysis toolkit - 1.1.095 5.0 55.0 99 5.0 55.0 2 95 7.0 77.0 99 NaN NaN big damp 3.0 33.0 blue dry 3.0 33.0 red red 4.0 44.0 wet 1.0 11.0 For more details and examples see the groupby documentation. match / %in% A common for x, val in np.ndenumerate(a)]) Out[29]: 0 1 2 3 0 0 0 0 1.0 1 0 0 1 2.0 2 0 0 2 3.0 3 0 0 3 4.0 4 0 1 0 5.0 .. .. .. .. ... 19 1 1 3 20.0 20 1 2 0 21.0 21 1 2 1 22.0 22 1 2 2 23.0 23 1 2 3 range(1, 5)) + [np.NAN])) In [31]: pd.DataFrame(a) Out[31]: 0 1 0 0 1.0 1 1 2.0 2 2 3.0 3 3 4.0 4 4 NaN For more details and examples see the Into to Data Structures documentation. melt.data.frame0 码力 | 3229 页 | 10.87 MB | 1 年前3
 pandas: powerful Python data analysis toolkit - 0.21.13], axis='index') \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\Out[15]: A B 0 1.0 4.0 1 2.0 5.0 3 NaN NaN The “index, columns” style continues to work as before. In [16]: df.rename(index=id \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\Out[17]: ˓→ A B C 0 1.0 4.0 NaN 1 2.0 5.0 NaN 3 NaN NaN NaN We highly encourage using named arguments to avoid confusion when 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.057737 0.165562 0.515018 5 6.0 -1.336936 00 码力 | 2207 页 | 8.59 MB | 1 年前3 pandas: powerful Python data analysis toolkit - 0.21.13], axis='index') \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\Out[15]: A B 0 1.0 4.0 1 2.0 5.0 3 NaN NaN The “index, columns” style continues to work as before. In [16]: df.rename(index=id \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\Out[17]: ˓→ A B C 0 1.0 4.0 NaN 1 2.0 5.0 NaN 3 NaN NaN NaN We highly encourage using named arguments to avoid confusion when 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.057737 0.165562 0.515018 5 6.0 -1.336936 00 码力 | 2207 页 | 8.59 MB | 1 年前3
共 29 条
- 1
- 2
- 3













