[Python] python error unsupported operand type(s) for &: 'str' and 'str [duplicate]

Discussão em 'Python' iniciado por Stack, Março 29, 2025.

  1. Stack

    Stack Membro Participativo

    Am getting an error and can't seem to figure it out

    unsupported operand type(s) for &: 'str' and 'str'

    def fun(row):
    if row['A'] == 'H' & row['B'] == np.nan:
    return row['A']

    df['_newcol'] = df.apply(fun, axis=1)


    any help or guidance is appreciated

    Continue reading...

Compartilhe esta Página