[Python] Run a dataframe of URLs through a function - Python

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

  1. Stack

    Stack Membro Participativo

    I am trying to use a dataframe that contains a bunch of URLs and run each individual URL through a function. Note: the function works perfectly if called with a single URL i.e. myfunction(https://www.example.com).

    # Example Dataframe (df)
    # Page Links
    # 0 https://www.example.com
    # 1 https://www.example2.com
    # 2 https://www.example3.com
    # 3 https://www.example4.com

    def myfunction(url):
    ...code...

    new_df = df.apply(myfunction, axis=1)


    This is the error I get: [​IMG]

    Continue reading...

Compartilhe esta Página