@@ -16,32 +16,32 @@ In [2]: import pandas as pd
16
16
In [3 ]: import pandas_selectable # magic
17
17
18
18
In [4 ]: dta = pd.DataFrame.from_dict({
19
- ... : ' A ' : [' A' , ' B' , ' C' ] * 5 ,
20
- ... : ' B ' : np.arange(1 , 16 ),
21
- ... : ' C ' : pd.date_range(' 2020-01-01' , periods = 15 )
19
+ ... : ' X ' : [' A' , ' B' , ' C' ] * 5 ,
20
+ ... : ' Y ' : np.arange(1 , 16 ),
21
+ ... : ' Z ' : pd.date_range(' 2020-01-01' , periods = 15 )
22
22
... : })
23
23
24
24
In [5 ]: dta.head()
25
25
Out[5 ]:
26
- A B C
26
+ X Y Z
27
27
0 A 1 2020 - 01 - 01
28
28
1 B 2 2020 - 01 - 02
29
29
2 C 3 2020 - 01 - 03
30
30
3 A 4 2020 - 01 - 04
31
31
4 B 5 2020 - 01 - 05
32
32
33
- In [6 ]: dta.select.A == ' B'
33
+ In [6 ]: dta.select.X == ' B'
34
34
Out[6 ]:
35
- A B C
35
+ X Y Z
36
36
1 B 2 2020 - 01 - 02
37
37
4 B 5 2020 - 01 - 05
38
38
7 B 8 2020 - 01 - 08
39
39
10 B 11 2020 - 01 - 11
40
40
13 B 14 2020 - 01 - 14
41
41
42
- In [7 ]: dta.select.C >= ' 2020-01-03'
42
+ In [7 ]: dta.select.Z >= ' 2020-01-03'
43
43
Out[7 ]:
44
- A B C
44
+ X Y Z
45
45
2 C 3 2020 - 01 - 03
46
46
3 A 4 2020 - 01 - 04
47
47
4 B 5 2020 - 01 - 05
@@ -56,45 +56,45 @@ Out[7]:
56
56
13 B 14 2020 - 01 - 14
57
57
14 C 15 2020 - 01 - 15
58
58
59
- In [8 ]: dta.select.A .str.contains(' A' )
59
+ In [8 ]: dta.select.X .str.contains(' A' )
60
60
Out[8 ]:
61
- A B C
61
+ X Y Z
62
62
0 A 1 2020 - 01 - 01
63
63
3 A 4 2020 - 01 - 04
64
64
6 A 7 2020 - 01 - 07
65
65
9 A 10 2020 - 01 - 10
66
66
12 A 13 2020 - 01 - 13
67
67
68
- In [9 ]: dta.select.C .dt.is_month_start
68
+ In [9 ]: dta.select.Z .dt.is_month_start
69
69
Out[9 ]:
70
- A B C
70
+ X Y Z
71
71
0 A 1 2020 - 01 - 01
72
72
```
73
73
74
74
It also works for Series.
75
75
76
76
``` python
77
- In [10 ]: dta.A .select == ' A'
77
+ In [10 ]: dta.X .select == ' A'
78
78
Out[10 ]:
79
79
0 A
80
80
3 A
81
81
6 A
82
82
9 A
83
83
12 A
84
- Name: A , dtype: object
84
+ Name: X , dtype: object
85
85
```
86
86
87
87
Though the string and datetime accessor APIs are slightly inconsistent. They're available via the select accessor now.
88
88
89
89
``` python
90
- In [11 ]: dta.A .select.str.contains(' B' )
90
+ In [11 ]: dta.X .select.str.contains(' B' )
91
91
Out[11 ]:
92
92
1 B
93
93
4 B
94
94
7 B
95
95
10 B
96
96
13 B
97
- Name: A , dtype: object
97
+ Name: X , dtype: object
98
98
```
99
99
100
100
## Requirements
0 commit comments