Skip to content

Commit 69c892a

Browse files
committed
Mollify the pedants
1 parent da5523a commit 69c892a

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,32 @@ In [2]: import pandas as pd
1616
In [3]: import pandas_selectable # magic
1717

1818
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)
2222
...: })
2323

2424
In [5]: dta.head()
2525
Out[5]:
26-
A B C
26+
X Y Z
2727
0 A 1 2020-01-01
2828
1 B 2 2020-01-02
2929
2 C 3 2020-01-03
3030
3 A 4 2020-01-04
3131
4 B 5 2020-01-05
3232

33-
In [6]: dta.select.A == 'B'
33+
In [6]: dta.select.X == 'B'
3434
Out[6]:
35-
A B C
35+
X Y Z
3636
1 B 2 2020-01-02
3737
4 B 5 2020-01-05
3838
7 B 8 2020-01-08
3939
10 B 11 2020-01-11
4040
13 B 14 2020-01-14
4141

42-
In [7]: dta.select.C >= '2020-01-03'
42+
In [7]: dta.select.Z >= '2020-01-03'
4343
Out[7]:
44-
A B C
44+
X Y Z
4545
2 C 3 2020-01-03
4646
3 A 4 2020-01-04
4747
4 B 5 2020-01-05
@@ -56,45 +56,45 @@ Out[7]:
5656
13 B 14 2020-01-14
5757
14 C 15 2020-01-15
5858

59-
In [8]: dta.select.A.str.contains('A')
59+
In [8]: dta.select.X.str.contains('A')
6060
Out[8]:
61-
A B C
61+
X Y Z
6262
0 A 1 2020-01-01
6363
3 A 4 2020-01-04
6464
6 A 7 2020-01-07
6565
9 A 10 2020-01-10
6666
12 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
6969
Out[9]:
70-
A B C
70+
X Y Z
7171
0 A 1 2020-01-01
7272
```
7373

7474
It also works for Series.
7575

7676
```python
77-
In [10]: dta.A.select == 'A'
77+
In [10]: dta.X.select == 'A'
7878
Out[10]:
7979
0 A
8080
3 A
8181
6 A
8282
9 A
8383
12 A
84-
Name: A, dtype: object
84+
Name: X, dtype: object
8585
```
8686

8787
Though 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')
9191
Out[11]:
9292
1 B
9393
4 B
9494
7 B
9595
10 B
9696
13 B
97-
Name: A, dtype: object
97+
Name: X, dtype: object
9898
```
9999

100100
## Requirements

0 commit comments

Comments
 (0)