Python Forum
FutureWarning: Logical ops (and, or, xor) between Pandas objects and dtype-less seque
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
FutureWarning: Logical ops (and, or, xor) between Pandas objects and dtype-less seque
#1
I have had this method on my code, it's been working fine, but as of today my code fails on this method:

def get_flags(series, flags, regex_flag):
    """ Identifies whether the series contains the flags under consideration.

    Args:
        series (pandas.DataFrame.Series): Series against which regular expressions will be matched.
        flags (list): List of regular expressions to be evaluated
    """
    m = [False] * len(series)
    series = series.astype(str).str.lower()
    for i, flag in enumerate(flags):
        flag = flag.lower()
        m = m | series.astype(str).str.contains(
            flag.lower(), regex=regex_flag, case=True,
        )
    return m
Now I get this error and my code stops running:

Output:
FutureWarning: Logical ops (and, or, xor) between Pandas objects and dtype-less sequences (e.g. list, tuple) are deprecated and will raise in a future version. Wrap the object in a Series, Index, or np.array before operating instead. m = m | series.astype(str).str.contains(
Please help.
Reply


Messages In This Thread
FutureWarning: Logical ops (and, or, xor) between Pandas objects and dtype-less seque - by NewBiee - Aug-31-2023, 02:18 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Data dtype error according to the rule "safe" AndreasMavro 5 9,315 Feb-27-2020, 10:46 PM
Last Post: Pama
  dtype in not working in mad() function ift38375 8 4,087 Jul-22-2019, 02:53 AM
Last Post: scidam
  ValueError: Input contains infinity or a value too large for dtype('float64') Rabah_r 1 12,952 Apr-06-2019, 11:08 AM
Last Post: scidam
  numpy dtype anomaly bluefrog 4 3,565 Nov-07-2018, 12:37 AM
Last Post: bluefrog

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020