[Python] FileUpload ipywidget: showing Error tuple

Discussão em 'Python' iniciado por Stack, Fevereiro 14, 2025.

  1. Stack

    Stack Membro Participativo

    i got a problem with the Fileupload Widget in Jupyter

    import pandas as pd
    import ipywidgets as widgets
    from ipywidgets import FileUpload
    from IPython.display import display

    upload = FileUpload(accept='.xlsx', multiple=False)

    def on_file_upload(change):
    uploaded_file = list(change['new'].values())[0]
    content = uploaded_file['content']
    df = pd.read_excel(content)
    display(df.head())

    upload.observe(on_file_upload, names='value')
    display(upload)


    In uploaded_file = list(change['new'].values())[0] i get the error AttributeError: 'tuple' object has no attribute 'values'

    Already tried everything and read the documentation but cant find a solution. Hope someone can help.

    A table is in the excel and i got 2 sheets inside.

    Continue reading...

Compartilhe esta Página