Skip to content

Commit

Permalink
update to DataFrame.map()
Browse files Browse the repository at this point in the history
  • Loading branch information
ceroberoz committed Aug 22, 2024
1 parent 4c0332d commit 710922e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion upload_to_sheets.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def read_csv(file_path):
# Replace NaN values with empty strings
df = df.fillna('')
# Convert all values to strings and strip whitespace
df = df.applymap(lambda x: str(x).strip() if isinstance(x, str) else x)
df = df.astype(str).apply(lambda x: x.str.strip())
return [df.columns.tolist()] + df.values.tolist()
except FileNotFoundError:
print(f"Error: CSV file not found at {file_path}")
Expand Down

0 comments on commit 710922e

Please sign in to comment.