Skip to content

Commit

Permalink
Merge pull request #49 from eshwen/esh_fix_substring_queries
Browse files Browse the repository at this point in the history
Adding option to change the engine used in dataframe queries for fast_plotter_postproc
  • Loading branch information
benkrikler authored Nov 9, 2020
2 parents a2d4126 + 01efcf0 commit 36cc9f2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fast_plotter/postproc/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ def __call__(self, row):


def handle_one_df(df, query=None, replacements=[],
combine_dims=[], combine_dims_ignore=None, combine_delim="__"):
combine_dims=[], combine_dims_ignore=None, combine_delim="__", engine_query=None):
if query:
df.query(query, inplace=True)
df.query(query, inplace=True, engine=engine_query)
if df.empty:
return
df.drop(df.filter(like="Unnamed").columns, axis=1, inplace=True)
Expand All @@ -51,13 +51,13 @@ def handle_one_df(df, query=None, replacements=[],
return df


def query(df, query):
def query(df, query, engine=None):
"""
Keep only rows that satisfy requirements of the query string,
See: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.query.html
"""
logger.info("Applying query: %s", query)
return handle_one_df(df, query=query)
return handle_one_df(df, query=query, engine_query=engine)


def rebin(df, axis, mapping, ignore_when_combining=None, rename=None, drop_others=False):
Expand Down

0 comments on commit 36cc9f2

Please sign in to comment.