Skip to content

Commit

Permalink
Optimize data sort order
Browse files Browse the repository at this point in the history
  • Loading branch information
kaaloo committed May 14, 2024
1 parent e62d5ba commit a43eb55
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions observable/src/data/films.sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@
# Set original title to blank string if same as title
df["original_title"] = df["original_title"].where(df["title"] != df["original_title"], "")

# Sort dataframe by 'popularity' in descending order
df = df.sort_values(by="popularity", ascending=False)

# Save the dataframe to a SQLite database
with tempfile.NamedTemporaryFile(suffix=".sqlite", delete=False) as temp_file:
temp_filename = temp_file.name
Expand Down
3 changes: 3 additions & 0 deletions observable/src/data/series.sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
"",
)

# Sort dataframe by 'popularity' in descending order
df = df.sort_values(by="popularity", ascending=False)

# Save the dataframe to a SQLite database
with tempfile.NamedTemporaryFile(suffix=".sqlite", delete=False) as temp_file:
temp_filename = temp_file.name
Expand Down

0 comments on commit a43eb55

Please sign in to comment.