Skip to content

Commit

Permalink
better way to check if can concat game genres
Browse files Browse the repository at this point in the history
  • Loading branch information
ddxv committed Oct 5, 2023
1 parent 303da67 commit 36a101c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
13 changes: 6 additions & 7 deletions adscrawler/app_stores/apple.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import re

import numpy as np
import pandas as pd
from itunes_app_scraper.scraper import AppStoreScraper
from itunes_app_scraper.util import AppStoreCategories, AppStoreCollections
Expand Down Expand Up @@ -133,13 +132,13 @@ def clean_ios_app_df(df: pd.DataFrame) -> pd.DataFrame:
if "price" not in df.columns:
df["price"] = 0
try:
df["category"] = np.where(
df["category"] == "Games",
"game_" + df["genres"].apply(lambda x: x.split(",")[1]),
df["category"],
)
df.loc[df["category"] == "Games", "category"] = "game_" + df.loc[
df["category"] == "Games", "genres"
].apply(lambda x: x.split(",")[1])
except Exception as e:
logger.warning(f"Split genre ID for iOS Game didn't work {e}")
logger.warning(
f"store_id={df['store_id'].values[0]} split genre IDs failed {e}"
)
df = df.assign(
free=df["price"] == 0,
developer_id=df["developer_id"].astype(str),
Expand Down
1 change: 1 addition & 0 deletions adscrawler/app_stores/scrape_stores.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,4 +344,5 @@ def log_crawl_results(app_df: pd.DataFrame, database_connection: PostgresCon) ->
"in_app_purchases",
"editors_choice",
"crawl_result",
"icon_url_512",
]

0 comments on commit 36a101c

Please sign in to comment.