Skip to content

Commit 422b6b3

Browse files
committed
RDD requirements
1 parent db2b670 commit 422b6b3

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,48 @@
11
# validframe
22
validators for pandas dataframes
3+
4+
## Here we go
5+
6+
```py
7+
import validframe as vf
8+
9+
df = pd.DataFrame([
10+
['a','b'], # headers
11+
[1,2], # row 1
12+
[1, None] # row 2
13+
[1, 'hello'] # row 3
14+
[1, 3.14] # row 4
15+
])
16+
17+
err_msg = "you wont see this error"
18+
err_msg = "you wont see this error"
19+
20+
assert vf.not_negative()(df), "you wont see this error"
21+
assert vf.not_empty()(df), "you will see this error"
22+
23+
assert vf.not_empty(row=0)(df), "you wont see this error"
24+
assert vf.not_empty(row=1)(df), "you will see this error"
25+
assert vf.not_empty(col='a')(df), "you wont see this error"
26+
assert vf.not_empty(col='b')(df), "you will see this error"
27+
28+
assert vf.totals(4, col='a')(df), "you won't see this error"
29+
assert vf.min(0, col='a')(df), "you won't see this error"
30+
assert vf.max(2, col='a')(df), "you won't see this error"
31+
32+
assert vf.ints(col='a')(df), "you won't see this error"
33+
assert vf.ints(col='b')(df), "you will see this error"
34+
35+
assert vf.strs(col='b', row=3)(df), "you won't see this error"
36+
assert vf.floats(col='b', row=4)(df), "you won't see this error"
37+
38+
assert vf.validate(lambda x: x.isnumeric, col='a')(df), "you won't see this error"
39+
40+
# validate that all cells that are numbers are positive
41+
assert vf.validate(lambda x: x>0, filter=lambda x: x.isnumeric() )(df), "you won't see this error"
42+
```
43+
44+
### boycotting lambdas?
45+
use functions instead
46+
```
47+
def
48+

0 commit comments

Comments
 (0)