Skip to content

Commit 5d1faba

Browse files
authored
Merge pull request #41 from cparmet/docs-typo
Fix typos in docstring example usage
2 parents 62f62fe + db84d8e commit 5d1faba

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

pandas_checks/DataFrameChecks.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,23 +114,23 @@ def assert_data(
114114
115115
Example:
116116
```python
117-
# Validate that the Dataframe has at least 2 rows
117+
# Validate that the Dataframe has at least 1 row
118118
119119
(
120120
iris
121-
.check.assert_data(lambda df: df.shape[0]>1)
121+
.check.assert_data(lambda df: df.shape[0]>0)
122122
123123
# Or customize the message displayed when alert fails
124-
.check.assert_data(lambda df: df.shape[0]>1, "Assertion failed, DataFrame has no rows!")
124+
.check.assert_data(lambda df: df.shape[0]>0, "Assertion failed, DataFrame has no rows!")
125125
126126
# Or show a warning instead of raising an exception
127-
.check.assert_data(lambda df: s.shape[0]>1, "FYI Series has no rows", raise_exception=False)
127+
.check.assert_data(lambda df: s.shape[0]>0, "FYI DataFrame has no rows", raise_exception=False)
128128
129129
# Or show a message if it passes, and raise a specific exception (ValueError) if it fails.
130130
.check.assert_data(
131131
lambda df: s.shape[0]>1,
132-
fail_message="FYI Series has no rows",
133-
pass_message="Series has rows!",
132+
fail_message="FYI DataFrame has 0 rows",
133+
pass_message="DataFrame has at least 1 row!",
134134
exception_to_raise=ValueError,
135135
verbose=True # To show pass_message when assertion passes
136136
)

pandas_checks/SeriesChecks.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,14 @@ def assert_data(
110110
iris
111111
["sepal_length"]
112112
113-
# Validate that a Series has at least 2 rows:
114-
.check.assert_data(lambda s: s.shape[0]>1)
113+
# Validate that a Series has at least 1 row:
114+
.check.assert_data(lambda s: s.shape[0]>0)
115115
116116
# Or customize the message displayed when alert fails
117-
.check.assert_data(lambda df: s.shape[0]>1, "Assertion failed, Series has no rows!")
117+
.check.assert_data(lambda df: s.shape[0]>0, "Assertion failed, Series has no rows!")
118118
119119
# Or show a warning instead of raising an exception
120-
.check.assert_data(lambda df: s.shape[0]>1, "FYI Series has no rows", raise_exception=False)
120+
.check.assert_data(lambda df: s.shape[0]>0, "FYI Series has no rows", raise_exception=False)
121121
)
122122
```
123123

0 commit comments

Comments
 (0)