Any tool for converting table to dictionary?

Do you have questions about writing plugins or scripts in Python? Meet the coders here.
Post Reply
kkl
Experienced User
Posts: 322
Joined: Wed May 04, 2011 9:32 pm

Any tool for converting table to dictionary?

Post by kkl » Sat Apr 04, 2020 9:35 pm

I need to create a large dictionary, around 50 lines, and have the data in a Excel table. Is there some tool or method that you programmers use to create large Python dictionaries so that you dont' have to type in all of the same formatting elements that repeat over and over again? Thanks for any tips.

User avatar
kgschlosser
Site Admin
Posts: 5498
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Any tool for converting table to dictionary?

Post by kgschlosser » Sun Apr 05, 2020 3:32 pm

I would need to know what the data looks like in Excel and also what you are trying to have it turn into in Python to be able to answer that question correctly. But there are some options depending on what you exactly have and what you are trying to do.

If you have columns of data and each column represents a specific type of data then you can export it to a csv file and load it using the pandas library.
Or of you want to interact directly with Excel that cal also be done. You can add or remove data from an Excel spreadsheet directly from Python code. There are several ways to go about doing it.
If you like the work I have been doing then feel free to Image

kkl
Experienced User
Posts: 322
Joined: Wed May 04, 2011 9:32 pm

Re: Any tool for converting table to dictionary?

Post by kkl » Sun Apr 05, 2020 6:39 pm

Thanks Kevin. I just wondered if there was some tool that you used specifically for this purpose. I've figured out a fairly straightforward way to do it in Excel.

User avatar
kgschlosser
Site Admin
Posts: 5498
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Any tool for converting table to dictionary?

Post by kgschlosser » Sun Apr 05, 2020 10:49 pm

again it depends on the specific purpose I needed the data for. where the data was coming from that populates Excel. There are so many possibilities it is all dependent on use case.
If you like the work I have been doing then feel free to Image

Post Reply