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
#3
(Aug-31-2023, 03:53 PM)deanhystad Wrote: I think this is the problem:
m = [False] * len(series)
This is not a "Series, Index, or np.array". Try m = numpy.full((len(series), False).

Hi, Thank you.

I tried this but my code started flagging errors(red line) under certain words, I've highlighted all places by putting them inside the square brackets.

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[)]
    m = np.full((len(series), False)
    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
Reply


Messages In This Thread
RE: FutureWarning: Logical ops (and, or, xor) between Pandas objects and dtype-less seque - by NewBiee - Sep-01-2023, 05:40 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Data dtype error according to the rule "safe" AndreasMavro 5 9,438 Feb-27-2020, 10:46 PM
Last Post: Pama
  dtype in not working in mad() function ift38375 8 4,188 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,993 Apr-06-2019, 11:08 AM
Last Post: scidam
  numpy dtype anomaly bluefrog 4 3,618 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