Skip to content

Commit

Permalink
fix: apply
Browse files Browse the repository at this point in the history
  • Loading branch information
polomarcus committed Jul 30, 2024
1 parent f000d01 commit 781783e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ services:
#entrypoint: ["python", "quotaclimat/data_processing/mediatree/api_import.py"]
environment:
ENV: docker # change me to prod for real cases
LOGLEVEL: INFO # Change me to info (debug, info, warning, error) to have less log
LOGLEVEL: DEBUG # Change me to info (debug, info, warning, error) to have less log
PYTHONPATH: /app
POSTGRES_USER: user
POSTGRES_DB: barometre
Expand Down
4 changes: 1 addition & 3 deletions quotaclimat/data_processing/mediatree/api_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,21 +230,19 @@ def parse_reponse_subtitle(response_sub, channel = None, channel_program = "", c
logging.getLogger("modin.logging.default").setLevel(logging.WARNING)
if(total_results > 0):
logging.info(f"{total_results} 'total_results' field")

new_df : pd.DataFrame = json_normalize(response_sub.get('data'))
logging.debug("Schema from API before formatting :\n%s", new_df.dtypes)
pd.set_option('display.max_columns', None)
logging.debug("head: :\n%s", new_df.head())
logging.debug(f"setting program {channel_program} type { type(channel_program)}")

# weird error if not using this way: (ValueError) format number 1 of "20h30 le samedi" is not recognized
new_df['channel_program'] = new_df.apply(lambda x: channel_program, axis=1)
new_df['channel_program_type'] = new_df.apply(lambda x: channel_program_type, axis=1)

logging.debug("programs were set")

logging.debug("setting timestamp")
new_df['timestamp'] = new_df.apply(lambda x: pd.to_datetime(new_df['start'], unit='s', utc=True), axis=1)
new_df['timestamp'] = new_df.apply(lambda x: pd.to_datetime(x['start'], unit='s', utc=True), axis=1)
logging.debug("timestamp was set")
new_df.drop('start', axis=1, inplace=True)
logging.debug("renaming columns")
Expand Down

0 comments on commit 781783e

Please sign in to comment.