Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use low_memory for merge_pubs #87

Merged
merged 1 commit into from
Jul 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions rialto_airflow/harvest/merge_pubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def dimensions_pubs_df(dimensions_pubs):
df = pl.scan_csv(
dimensions_pubs,
schema_overrides={"volume": pl.String, "pmid": pl.String, "year": pl.String},
low_memory=True,
)
df = df.select(
pl.col("doi").map_elements(normalize_doi, return_dtype=pl.String),
Expand All @@ -74,7 +75,9 @@ def openalex_pubs_df(openalex_pubs):
"""
Create an openalex pubs LazyFrame and rename columns
"""
df = pl.scan_csv(openalex_pubs, schema_overrides={"publication_year": pl.String})
df = pl.scan_csv(
openalex_pubs, schema_overrides={"publication_year": pl.String}, low_memory=True
)
df = df.select(
pl.col("doi").map_elements(normalize_doi, return_dtype=pl.String),
pl.col(
Expand All @@ -89,7 +92,11 @@ def sulpub_df(sul_pub):
"""
Create a sulpub LazyFrame and rename columns
"""
df = pl.scan_csv(sul_pub, schema_overrides={"year": pl.String, "pmid": pl.String})
df = pl.scan_csv(
sul_pub,
schema_overrides={"year": pl.String, "pmid": pl.String},
low_memory=True,
)
df = df.drop_nulls("doi")
df = df.with_columns(
pl.col("doi").map_elements(normalize_doi, return_dtype=pl.String)
Expand Down
Loading