Skip to content

Commit

Permalink
Merge pull request #165 from JPhillips92/master
Browse files Browse the repository at this point in the history
Suppress pandas FutureWarnings
  • Loading branch information
yehoshuadimarsky authored Dec 2, 2024
2 parents a81b0e4 + 6971b28 commit 78ddcd6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions bcpandas/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ class BCPandasValueError(BCPandasException):

def get_delimiter(df: pd.DataFrame) -> str:
for delim in _DELIMITER_OPTIONS:
if not df.applymap(lambda x: delim in x if isinstance(x, str) else False).any().any():
if not df.map(lambda x: delim in x if isinstance(x, str) else False).any().any():
return delim
raise BCPandasValueError(error_msg.format(typ="delimiter", opts=_DELIMITER_OPTIONS))


def get_quotechar(df: pd.DataFrame) -> str:
for qc in _QUOTECHAR_OPTIONS:
if not df.applymap(lambda x: qc in x if isinstance(x, str) else False).any().any():
if not df.map(lambda x: qc in x if isinstance(x, str) else False).any().any():
return qc
raise BCPandasValueError(error_msg.format(typ="quote", opts=_QUOTECHAR_OPTIONS))
4 changes: 2 additions & 2 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@

def not_has_all_delims(df: pd.DataFrame) -> bool:
return not all(
df.applymap(lambda x: delim in x if isinstance(x, str) else False).any().any()
df.map(lambda x: delim in x if isinstance(x, str) else False).any().any()
for delim in _DELIMITER_OPTIONS
)


def not_has_all_quotechars(df: pd.DataFrame) -> bool:
return not all(
df.applymap(lambda x: qc in x if isinstance(x, str) else False).any().any()
df.map(lambda x: qc in x if isinstance(x, str) else False).any().any()
for qc in _QUOTECHAR_OPTIONS
)

Expand Down

0 comments on commit 78ddcd6

Please sign in to comment.