Excel Datei in Dictionary unwandeln Python?

Wie wandelt man eine Excel Datei in ein Dictionary um. Ich habe mit import Pandas as pd eine Excel Datei importiert, nun möchte ich dies in ein Dictionary um wandeln. Wie bekomme ich das hin mit dem Befehl df.to_dict()? Am besten mit unkomplizierten Befehlen..

Mein Ansatz bis jetzt:

import pandas as pd

Tabelle=pd.read_excel(“Tabelle.xlsx”)

……

(1 votes)
Loading...

Similar Posts

Subscribe
Notify of
5 Answers
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
regex9
2 months ago

The read_excel– Method provides Dataframe– Objects. In turn, one knows to_dict-Method.

regex9
2 months ago
Reply to  Izdtidico

The necessary methods are in my answer.

Example:

import pandas as pd

tabelle = pd.read_excel("Tabelle.xlsx")
daten = tabelle.to_dict()
regex9
2 months ago

Compare your associated code section with that of me. Except for the names of variables, there should be no major differences.

The next step would be to check exactly what is going on across.

  • Perhaps there is an error message, then their wording is also of interest. In the best case, it refers to a specific code line, because then it is clear where to search.
  • You might experience an unexpected behavior. This should be described in more detail.

I only give help here on the public platform.