Skip to content

Commit

Permalink
Changed the way empty columns are dropped
Browse files Browse the repository at this point in the history
  • Loading branch information
Adi Eyal committed Sep 6, 2020
1 parent b7b0b8e commit 10eb70a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions wazimap_ng/points/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,15 @@ def process_uploaded_file(point_file, subtheme, **kwargs):
error_logs = []

df = pd.read_csv(point_file.document.open(), nrows=1, dtype=str, sep=",")
old_columns = df.columns.str.lower()
df.dropna(how='all', axis='columns', inplace=True)
columns = df.columns.str.lower()
new_columns = df.columns.str.lower()

for df in pd.read_csv(
point_file.document.open(), chunksize=chunksize, skiprows=1, sep=",", header=None, keep_default_na=False
):
df.dropna(how='any', axis='columns', inplace=True)
df.columns = columns
df.columns = old_columns
df = df.loc[:, new_columns]
datasource = (dict(d[1]) for d in df.iterrows())
logs = loaddata(subtheme, datasource, row_number)

Expand Down

0 comments on commit 10eb70a

Please sign in to comment.