Skip to content

Commit 046d4c3

Browse files
authored
Merge pull request #26 from haim0n/master
Fix readme documentation
2 parents f930814 + 2f6c134 commit 046d4c3

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,17 @@ and passing the decorator an accessor name.
3434
```python
3535
# my_flavor.py
3636

37-
import pandas as pd
3837
import pandas_flavor as pf
3938

4039
@pf.register_dataframe_accessor('my_flavor')
4140
class MyFlavor(object):
4241

4342
def __init__(self, data):
44-
self._data
43+
self._data = data
4544

46-
def row_by_value(self, col, value):
47-
"""Slice out row from DataFrame by a value."""
48-
return self._data[self._data[col] == value].squeeze()
45+
def row_by_value(self, col, value):
46+
"""Slice out row from DataFrame by a value."""
47+
return self._data[self._data[col] == value].squeeze()
4948

5049
```
5150

@@ -87,7 +86,6 @@ intermediate accessor is needed.
8786
```python
8887
# my_flavor.py
8988

90-
import pandas as pd
9189
import pandas_flavor as pf
9290

9391
@pf.register_dataframe_method
@@ -98,10 +96,11 @@ def row_by_value(df, col, value):
9896
```
9997

10098
```python
99+
import pandas as pd
101100
import my_flavor
102101

103102
# DataFrame.
104-
df = DataFrame(data={
103+
df = pd.DataFrame(data={
105104
"x": [10, 20, 25],
106105
"y": [0, 2, 5]
107106
})

0 commit comments

Comments
 (0)