Open
Conversation
GregW04
reviewed
Feb 13, 2026
|
|
||
| df_events = df_events.copy() | ||
| df_events["location_filtered"] = df_events["location"].str.contains( | ||
| location_regex, case=False, regex=True, na=False |
There was a problem hiding this comment.
Check if regex = False would work (it is faster). If not - stay with current approach
Member
Author
There was a problem hiding this comment.
But the location_regex is a regex not a normal string, so as far as I'm concerned regex=True is mandatory here
GregW04
reviewed
Feb 13, 2026
| """Creates a boolean column "location_filtered" in the input dataframe df_events, | ||
| indicating whether the "location" column matches any of the specified regex patterns.""" | ||
|
|
||
| df_events = df_events.copy() |
There was a problem hiding this comment.
as making copy is costly for Memory let's make it optional throught the functions -> add parameter: copy: bool = False
GregW04
reviewed
Feb 13, 2026
| r"strefa kultury studenckiej", | ||
| r"geocentrum" | ||
| ] | ||
|
|
There was a problem hiding this comment.
for reapeated use try to compile patterns once e.g. location_pattern = re.compile(location_combined_regex, re.IGNORECASE
GregW04
reviewed
Feb 13, 2026
| df_events = filter_event_locations(df_events, location_regex) | ||
| df_events = filter_event_summaries(df_events, summary_regex) | ||
|
|
||
| df_events["filter_events"] = (df_events["location_filtered"] | df_events["summary_filtered"]) |
There was a problem hiding this comment.
please change the name for the new column to sth like: is_event_filtered
|
@DominikaStefaniak PR review rdy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Creates three functions that add new columns to the events DataFrame indicating whether an event takes place on the PWr campus. The determination is based on the event's location, summary, and a combined check.