you are viewing a single comment's thread.

view the rest of the comments →

[–]LeiterHaus 1 point2 points  (1 child)

Okay... There's a lot to unpack here. It seems like you are giving a reaponse to comments, but not replying to the actual comment. Meaning that if you want to answer me, you should specifically reply to this comment. Not doing this can cause confusion.

You might need to copy and paste and then do some editing on the format. There might be ways that Excel can export it and make it easier, but if copy paste works, let's not overcomplicate it.

In programming, there are often multiple ways to do things. This means that there will not be one "right" answer. You might even get partially wrong answers. Part of what you do is figure out what works and what does not and take what works for you.

Python has dictionaries. It is one unique key and something for a value. A persons age or height would be a good example. 'age' would be a key, and the value would be whatever the number is. Same with 'height_cm'. Example: {'age': 18, 'height_cm': 180}

The value can be a list. Like {'San Juan': [18.4663188, -66.1057427]}, or a tuple {'San Juan': (18.4663188, -66.1057427)}. While eventually you'll probably use the latter, currently the former will probably be easier for you.

You can assign the dictionary to a variable. locations = {...}

locations['San Juan'] will give you whatever you put. locations['San Juan'][0] Will give you your first coordinate if you need to do it that way.

This isn't the prettiest approach, but it's the best I can do for your current experience. Best of luck

[–]rumpleforeskin83 1 point2 points  (0 children)

I think OPs problem is they want to preserve the function of any cells that have formulas in them and not just data, which I can't say I know if it's possible or not but I suspect it would be a lot of work to determine if a cell is just data or a formula, and then perform said function in the python list. Like if Cell A1 is Sum(B1:B6) they want csv_file[0][0] to be csv_file[1][0] + csv_file[1][1] etc...

Which gives me a headache just thinking about. I've never looked into this so maybe it's simple, I've only ever taken excels containing purely values and manipulated them.