Skip to content

Commit

Permalink
fix: csv parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafael Elter committed Nov 24, 2023
1 parent d01ae62 commit ee142db
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/b3od/scrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,17 @@ def __download_web_consolidated(self, table: str, query_date: Any) -> pd.DataFra
sep=";",
decimal=",",
dtype=SERVICES_DTYPES[table],
parse_dates=SERVICES_DATE_COLUMNS[table],
date_parser=(
lambda x: datetime.strptime(x, "%Y-%m-%d").date()
if not pd.isna(x)
else np.nan
),
skiprows=1 # Remove header line ('Status do Arquivo: ...')
)

queried_data[SERVICES_DATE_COLUMNS[table]] = queried_data[
SERVICES_DATE_COLUMNS[table]
].map(
lambda x: datetime.strptime(x, "%Y-%m-%d").date()
if not pd.isna(x)
else np.nan,
)

return queried_data

def __download_web_consolidated_many(
Expand Down

0 comments on commit ee142db

Please sign in to comment.