Skip to content

Commit

Permalink
Update dataframe indexing syntax to avoid deprecated usage.
Browse files Browse the repository at this point in the history
  • Loading branch information
pbeaucage committed Mar 29, 2024
1 parent 31a7f45 commit 1997bd7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/PyHyperScattering/SST1RSoXSDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def searchCatalog(
# For numeric entries, do Key equality
if "numeric" in str(searchSeries[2]):
reducedCatalog = reducedCatalog.search(
Key(searchSeries[0]) == float(searchSeries[1])
Key(searchSeries.iloc[0]) == float(searchSeries.iloc[1])
)

else: # Build regex search string
Expand All @@ -299,16 +299,16 @@ def searchCatalog(
# Regex cheatsheet:
# (?i) is case insensitive
# ^_$ forces exact match to _, ^ anchors the start, $ anchors the end
if "case-insensitive" in str(searchSeries[2]):
if "case-insensitive" in str(searchSeries.iloc[2]):
reg_prefix += "(?i)"
if "exact" in searchSeries[2]:
if "exact" in searchSeries.iloc[2]:
reg_prefix += "^"
reg_postfix += "$"

regexString = reg_prefix + str(searchSeries[1]) + reg_postfix
regexString = reg_prefix + str(searchSeries.iloc[1]) + reg_postfix

# Search/reduce the catalog
reducedCatalog = reducedCatalog.search(Regex(searchSeries[0], regexString))
reducedCatalog = reducedCatalog.search(Regex(searchSeries.iloc[0], regexString))

# If a match fails, notify the user which search parameter yielded 0 results
if len(reducedCatalog) == 0:
Expand Down

0 comments on commit 1997bd7

Please sign in to comment.