[Python] Selecting with complex criteria from pandas.DataFrame

Discussão em 'Python' iniciado por Stack, Abril 28, 2025.

  1. Stack

    Stack Membro Participativo

    For example I have simple DF:

    import pandas as pd
    from random import randint

    df = pd.DataFrame({'A': [randint(1, 9) for x in range(10)],
    'B': [randint(1, 9)*10 for x in range(10)],
    'C': [randint(1, 9)*100 for x in range(10)]})


    Can I select values from 'A' for which corresponding values for 'B' will be greater than 50, and for 'C' - not equal to 900, using methods and idioms of Pandas?

    Continue reading...

Compartilhe esta Página