Spaces:
Runtime error
Runtime error
fix actress selection when combining data
Browse files- combine_actors_data.py +2 -2
combine_actors_data.py
CHANGED
@@ -15,7 +15,7 @@ def process_actors_data(keep_alive: bool = True):
|
|
15 |
df = df[df["deathYear"].isna()]
|
16 |
df = df[df.knownForTitles.apply(lambda x: len(x)) > 0]
|
17 |
df = df.dropna(subset=["primaryProfession"])
|
18 |
-
df = df[df.primaryProfession.apply(lambda x: "actor" in x.split(","))]
|
19 |
df = df[df.knownForTitles != "\\N"]
|
20 |
df = df.dropna(subset=["birthYear"])
|
21 |
#df["knownForTitles"] = df["knownForTitles"].apply(lambda x: x.split(","))
|
@@ -23,7 +23,7 @@ def process_actors_data(keep_alive: bool = True):
|
|
23 |
#dfat = df[["nconst", "knownForTitles"]].explode("knownForTitles")
|
24 |
#dfat.columns = ["nconst", "tconst"]
|
25 |
dfat = pd.read_csv("data/title.principals.tsv.gz", sep="\t")
|
26 |
-
dfat = dfat[dfat.category.isin(["actor", "self"])][["tconst", "nconst"]]
|
27 |
|
28 |
|
29 |
# Get data for the movies/shows the actors were known for
|
|
|
15 |
df = df[df["deathYear"].isna()]
|
16 |
df = df[df.knownForTitles.apply(lambda x: len(x)) > 0]
|
17 |
df = df.dropna(subset=["primaryProfession"])
|
18 |
+
df = df[df.primaryProfession.apply(lambda x: any([p in {"actor", "actress"} for p in x.split(",")]))]
|
19 |
df = df[df.knownForTitles != "\\N"]
|
20 |
df = df.dropna(subset=["birthYear"])
|
21 |
#df["knownForTitles"] = df["knownForTitles"].apply(lambda x: x.split(","))
|
|
|
23 |
#dfat = df[["nconst", "knownForTitles"]].explode("knownForTitles")
|
24 |
#dfat.columns = ["nconst", "tconst"]
|
25 |
dfat = pd.read_csv("data/title.principals.tsv.gz", sep="\t")
|
26 |
+
dfat = dfat[dfat.category.isin(["actor", "actress", "self"])][["tconst", "nconst"]]
|
27 |
|
28 |
|
29 |
# Get data for the movies/shows the actors were known for
|