this entry collects the solution files i have for fill missing data. i may expand it with a fuller write-up later, but the implementation files are already here.
available solution files
- Python
fill-missing-data/fill-missing-data.py
notes and solution files for fill missing data.
this entry collects the solution files i have for fill missing data. i may expand it with a fuller write-up later, but the implementation files are already here.
fill-missing-data/fill-missing-data.pyimport pandas as pd
def fillMissingValues(products: pd.DataFrame) -> pd.DataFrame:
products[class="syntax-string">'quantity'] = products[class="syntax-string">'quantity'].fillna(class="syntax-number">0)
return products
products[class="syntax-string">'quantity'].fillna(class="syntax-number">0, inplace = True)
return products
products.fillna(value={class="syntax-string">'quantity': class="syntax-number">0}, inplace = True)
return products
products.loc[products[class="syntax-string">'quantity'].isnull(),class="syntax-string">'quantity'] = class="syntax-number">0
return products
result = []
for i in products.quantity:
if pd.isna(i):
result.append(class="syntax-number">0)
continue
result.append(i)
products[class="syntax-string">'quantity'] = result
return products