pandas: powerful Python data analysis toolkit - 1.0.0
[94]: dfd Out[94]: A B a 1 4 b 2 5 c 3 6 Previous behavior, where you wish to get the 0th and the 2nd elements from the index in the ‘A’ column. In [3]: dfd.ix[[0, 2], 'A'] Out[3]: a 1 c 3 Name: A, In [83]: df.xs('BB', level=0, axis=0) Out[83]: MyData one 33 two 44 six 55 . . . and now the 2nd level of the 1st axis. In [84]: df.xs('six', level=1, axis=0) Out[84]: MyData AA 22 BB 55 Slicing Specify None to get all sheets. Available cases: • Defaults to 0: 1st sheet as a DataFrame • 1: 2nd sheet as a DataFrame • "Sheet1": Load sheet with name “Sheet1” • [0, 1, "Sheet5"]: Load first, second0 码力 | 3015 页 | 10.78 MB | 1 年前3pandas: powerful Python data analysis toolkit - 0.25.0
(continued from previous page) b 2 5 c 3 6 Previous behavior, where you wish to get the 0th and the 2nd elements from the index in the ‘A’ column. In [3]: dfd.ix[[0, 2], 'A'] Out[3]: a 1 c 3 Name: A, In [83]: df.xs('BB', level=0, axis=0) Out[83]: MyData one 33 two 44 six 55 . . . and now the 2nd level of the 1st axis. In [84]: df.xs('six', level=1, axis=0) Out[84]: MyData AA 22 BB 55 Slicing Specify None to get all sheets. Available cases: • Defaults to 0: 1st sheet as a DataFrame • 1: 2nd sheet as a DataFrame • "Sheet1": Load sheet with name “Sheet1” • [0, 1, "Sheet5"]: Load first, second0 码力 | 2827 页 | 9.62 MB | 1 年前3pandas: powerful Python data analysis toolkit - 0.25.1
(continued from previous page) b 2 5 c 3 6 Previous behavior, where you wish to get the 0th and the 2nd elements from the index in the ‘A’ column. In [3]: dfd.ix[[0, 2], 'A'] Out[3]: a 1 c 3 Name: A, In [83]: df.xs('BB', level=0, axis=0) Out[83]: MyData one 33 two 44 six 55 . . . and now the 2nd level of the 1st axis. 848 Chapter 4. User Guide pandas: powerful Python data analysis toolkit, Release Specify None to get all sheets. Available cases: • Defaults to 0: 1st sheet as a DataFrame • 1: 2nd sheet as a DataFrame • "Sheet1": Load sheet with name “Sheet1” • [0, 1, "Sheet5"]: Load first, second0 码力 | 2833 页 | 9.65 MB | 1 年前3pandas: powerful Python data analysis toolkit - 1.0
[94]: dfd Out[94]: A B a 1 4 b 2 5 c 3 6 Previous behavior, where you wish to get the 0th and the 2nd elements from the index in the ‘A’ column. In [3]: dfd.ix[[0, 2], 'A'] Out[3]: a 1 c 3 Name: A, In [83]: df.xs('BB', level=0, axis=0) Out[83]: MyData one 33 two 44 six 55 . . . and now the 2nd level of the 1st axis. In [84]: df.xs('six', level=1, axis=0) Out[84]: MyData AA 22 BB 55 Slicing Specify None to get all sheets. Available cases: • Defaults to 0: 1st sheet as a DataFrame • 1: 2nd sheet as a DataFrame • "Sheet1": Load sheet with name “Sheet1” • [0, 1, "Sheet5"]: Load first, second0 码力 | 3091 页 | 10.16 MB | 1 年前3pandas: powerful Python data analysis toolkit - 1.0.4
[94]: dfd Out[94]: A B a 1 4 b 2 5 c 3 6 Previous behavior, where you wish to get the 0th and the 2nd elements from the index in the ‘A’ column. In [3]: dfd.ix[[0, 2], 'A'] Out[3]: a 1 c 3 Name: A, In [83]: df.xs('BB', level=0, axis=0) Out[83]: MyData one 33 two 44 six 55 . . . and now the 2nd level of the 1st axis. In [84]: df.xs('six', level=1, axis=0) Out[84]: MyData AA 22 BB 55 Slicing Specify None to get all sheets. Available cases: • Defaults to 0: 1st sheet as a DataFrame • 1: 2nd sheet as a DataFrame • "Sheet1": Load sheet with name “Sheet1” • [0, 1, "Sheet5"]: Load first, second0 码力 | 3081 页 | 10.24 MB | 1 年前3pandas: powerful Python data analysis toolkit - 1.1.1
[94]: dfd Out[94]: A B a 1 4 b 2 5 c 3 6 Previous behavior, where you wish to get the 0th and the 2nd elements from the index in the ‘A’ column. In [3]: dfd.ix[[0, 2], 'A'] Out[3]: a 1 c 3 Name: A, In [83]: df.xs('BB', level=0, axis=0) Out[83]: MyData one 33 two 44 six 55 . . . and now the 2nd level of the 1st axis. In [84]: df.xs('six', level=1, axis=0) Out[84]: MyData AA 22 BB 55 Slicing analysis toolkit, Release 1.1.1 Available cases: • Defaults to 0: 1st sheet as a DataFrame • 1: 2nd sheet as a DataFrame • "Sheet1": Load sheet with name “Sheet1” • [0, 1, "Sheet5"]: Load first, second0 码力 | 3231 页 | 10.87 MB | 1 年前3pandas: powerful Python data analysis toolkit - 1.1.0
[94]: dfd Out[94]: A B a 1 4 b 2 5 c 3 6 Previous behavior, where you wish to get the 0th and the 2nd elements from the index in the ‘A’ column. In [3]: dfd.ix[[0, 2], 'A'] Out[3]: a 1 c 3 Name: A, In [83]: df.xs('BB', level=0, axis=0) Out[83]: MyData one 33 two 44 six 55 . . . and now the 2nd level of the 1st axis. In [84]: df.xs('six', level=1, axis=0) Out[84]: MyData AA 22 BB 55 Slicing analysis toolkit, Release 1.1.0 Available cases: • Defaults to 0: 1st sheet as a DataFrame • 1: 2nd sheet as a DataFrame • "Sheet1": Load sheet with name “Sheet1” • [0, 1, "Sheet5"]: Load first, second0 码力 | 3229 页 | 10.87 MB | 1 年前3pandas: powerful Python data analysis toolkit -1.0.3
[94]: dfd Out[94]: A B a 1 4 b 2 5 c 3 6 Previous behavior, where you wish to get the 0th and the 2nd elements from the index in the ‘A’ column. In [3]: dfd.ix[[0, 2], 'A'] Out[3]: a 1 c 3 Name: A, In [83]: df.xs('BB', level=0, axis=0) Out[83]: MyData one 33 two 44 six 55 . . . and now the 2nd level of the 1st axis. In [84]: df.xs('six', level=1, axis=0) Out[84]: MyData AA 22 BB 55 Slicing Specify None to get all sheets. Available cases: • Defaults to 0: 1st sheet as a DataFrame • 1: 2nd sheet as a DataFrame • "Sheet1": Load sheet with name “Sheet1” • [0, 1, "Sheet5"]: Load first, second0 码力 | 3071 页 | 10.10 MB | 1 年前3pandas: powerful Python data analysis toolkit - 1.2.3
16.0 38.0 2.5.8 Combining positional and label-based indexing If you wish to get the 0th and the 2nd elements from the index in the ‘A’ column, you can do: In [98]: dfd = pd.DataFrame({'A': [1, 2, 3] In [83]: df.xs("BB", level=0, axis=0) Out[83]: MyData one 33 two 44 six 55 . . . and now the 2nd level of the 1st axis. In [84]: df.xs("six", level=1, axis=0) Out[84]: MyData AA 22 BB 55 Slicing Specify None to get all sheets. Available cases: • Defaults to 0: 1st sheet as a DataFrame • 1: 2nd sheet as a DataFrame • "Sheet1": Load sheet with name “Sheet1” • [0, 1, "Sheet5"]: Load first, second0 码力 | 3323 页 | 12.74 MB | 1 年前3pandas: powerful Python data analysis toolkit - 1.3.2
16.0 38.0 2.5.8 Combining positional and label-based indexing If you wish to get the 0th and the 2nd elements from the index in the ‘A’ column, you can do: In [98]: dfd = pd.DataFrame({'A': [1, 2, 3] In [83]: df.xs("BB", level=0, axis=0) Out[83]: MyData one 33 two 44 six 55 . . . and now the 2nd level of the 1st axis. In [84]: df.xs("six", level=1, axis=0) Out[84]: MyData AA 22 BB 55 Slicing analysis toolkit, Release 1.3.2 Available cases: • Defaults to 0: 1st sheet as a DataFrame • 1: 2nd sheet as a DataFrame • "Sheet1": Load sheet with name “Sheet1” • [0, 1, "Sheet5"]: Load first, second0 码力 | 3509 页 | 14.01 MB | 1 年前3
共 26 条
- 1
- 2
- 3