def cleanNullColumns(sheet):
"""
Helper function to discard columns in sheets where each value in column is null.
Accepts a DataFrame as the sheet argument.
Returns the cleaned dataframe or an error Tuple of (False, error)
"""
try:# check for and remove columns with all NaNs
for column in sheet.columns:
if pd.isnull(sheet[column]).all():
sheet.drop(column, axis=1, inplace=True)
return sheet
except Exception as e:
return False, e
评论列表
文章目录