Skip to content

Commit f4628a7

Browse files
George RobertsonGeorge Robertson
authored andcommitted
Made changes to check_null by removing unnecessary code and added fix to examples
1 parent 3f55610 commit f4628a7

1 file changed

Lines changed: 5 additions & 13 deletions

File tree

codonPython/check_null.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import numpy
22
import pandas as pd
33

4-
def count_null(dataframe: pd.DataFrame) -> bool:
4+
def check_null(dataframe: pd.DataFrame) -> bool:
55
"""
66
Checks a pandas dataframe for null values
77
@@ -19,19 +19,11 @@ def count_null(dataframe: pd.DataFrame) -> bool:
1919
2020
Examples
2121
--------
22-
>>> count_null(data)
23-
True
24-
>>> count_null(data)
22+
>>> check_null(data = pandas.DataFrame(data = {'col1': [1,2], 'col2': [3,4]}))
2523
False
24+
>>> check_null(data = {'col1': [1,numpy.nan], 'col2': [3,4]})
25+
True
2626
"""
2727
null_count = dataframe.isnull().values.any()
28-
col_names = dataframe.columns.tolist()
2928

30-
if null_count == True:
31-
col_value = dataframe.isnull().any().tolist()
32-
print(col_names)
33-
print(col_value)
34-
return True
35-
else:
36-
print("No null values found")
37-
return False
29+
return null_count

0 commit comments

Comments
 (0)