You can add a Pandas DataFrame series to a Python dictionary using the following code:
main.py317 chars14 lines
The output will be:
main.py75 chars7 lines
In this example, we created a Pandas DataFrame with a single column called Column1. Next, we created an empty Python dictionary called my_dict. We then added the DataFrame column df['Column1'] to the dictionary as a value, and chose my_key as the key. Finally, we printed the dictionary to show the result.
gistlibby LogSnag