@@ -16,32 +16,32 @@ In [2]: import pandas as pd
1616In [3 ]: import pandas_selectable # magic
1717
1818In [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 )
2222 ... : })
2323
2424In [5 ]: dta.head()
2525Out[5 ]:
26- A B C
26+ X Y Z
27270 A 1 2020 - 01 - 01
28281 B 2 2020 - 01 - 02
29292 C 3 2020 - 01 - 03
30303 A 4 2020 - 01 - 04
31314 B 5 2020 - 01 - 05
3232
33- In [6 ]: dta.select.A == ' B'
33+ In [6 ]: dta.select.X == ' B'
3434Out[6 ]:
35- A B C
35+ X Y Z
36361 B 2 2020 - 01 - 02
37374 B 5 2020 - 01 - 05
38387 B 8 2020 - 01 - 08
393910 B 11 2020 - 01 - 11
404013 B 14 2020 - 01 - 14
4141
42- In [7 ]: dta.select.C >= ' 2020-01-03'
42+ In [7 ]: dta.select.Z >= ' 2020-01-03'
4343Out[7 ]:
44- A B C
44+ X Y Z
45452 C 3 2020 - 01 - 03
46463 A 4 2020 - 01 - 04
47474 B 5 2020 - 01 - 05
@@ -56,45 +56,45 @@ Out[7]:
565613 B 14 2020 - 01 - 14
575714 C 15 2020 - 01 - 15
5858
59- In [8 ]: dta.select.A .str.contains(' A' )
59+ In [8 ]: dta.select.X .str.contains(' A' )
6060Out[8 ]:
61- A B C
61+ X Y Z
62620 A 1 2020 - 01 - 01
63633 A 4 2020 - 01 - 04
64646 A 7 2020 - 01 - 07
65659 A 10 2020 - 01 - 10
666612 A 13 2020 - 01 - 13
6767
68- In [9 ]: dta.select.C .dt.is_month_start
68+ In [9 ]: dta.select.Z .dt.is_month_start
6969Out[9 ]:
70- A B C
70+ X Y Z
71710 A 1 2020 - 01 - 01
7272```
7373
7474It also works for Series.
7575
7676``` python
77- In [10 ]: dta.A .select == ' A'
77+ In [10 ]: dta.X .select == ' A'
7878Out[10 ]:
79790 A
80803 A
81816 A
82829 A
838312 A
84- Name: A , dtype: object
84+ Name: X , dtype: object
8585```
8686
8787Though the string and datetime accessor APIs are slightly inconsistent. They're available via the select accessor now.
8888
8989``` python
90- In [11 ]: dta.A .select.str.contains(' B' )
90+ In [11 ]: dta.X .select.str.contains(' B' )
9191Out[11 ]:
92921 B
93934 B
94947 B
959510 B
969613 B
97- Name: A , dtype: object
97+ Name: X , dtype: object
9898```
9999
100100## Requirements
0 commit comments