Questions tagged [dictionary]
A dictionary maps keys to values allowing efficient retrieval of values by keys. Use the [map-function] tag for mapping functions; use the [maps] tag for geography.
dictionary
86,224
questions
-2
votes
0
answers
25
views
Why do I get "NoneType object is not iterable" when filtering a list of dictionaries with list comprehension and handling None?
In Python, I am filtering a list of dictionaries with a key using list comprehension. I am handling None but still get an error "NoneType object is not iterable". I know this must be a ...
-3
votes
1
answer
42
views
Dictionary Update Stops at Index 35
I'm trying to iterate through a list (config_patterns) and add each element as a key to a dictionary (predefined_patterns) with a value of 0. There are 40 elements in this list. However, the final ...
1
vote
2
answers
33
views
Converting JSON list with multiple nested dictionaries to csv or excel
I have a JSON that I download from a website that has multiple nested dictionaries inside the main list. This is a very simplified version of it.
[
{
"id": 1,
"...
2
votes
2
answers
34
views
Dictionary indexing with Numpy/Jax
I'm writing an interpolation routine and have a dictionary which stores the function values at the fitting points. Ideally, the dictionary keys would be 2D Numpy arrays of the fitting point ...
0
votes
0
answers
6
views
Showing TIF image as overlay on top of Folium map in Python Jupyter
I am a bit of a newbie to more complex mapping in Python and Jupyter. I am trying to display a TIF image as an overlay on top of a Folium map I created. I tried various approaches (after intensive ...
-4
votes
1
answer
49
views
How to convert a tuple which includes a [string] to a dictionary item
I have this list:
address_table3 = [(1, ['21 South Main']), (2, ['1560 West St']), (3, ['1900 Broadway'])]
I want to convert it to a dictionary with the address as key and integer as value.
When I ...
0
votes
1
answer
15
views
Modify the values in a (global) list of dictionary without reference
I'm new to python - being an educator trying to write to python script to score student's performance downloaded from an online polling platform. I've solved most problems until something like this: I'...
0
votes
1
answer
18
views
How to make a flexible argument list for cursor.execute in python3?
In fact, I want to increase and decrease the mysql query items and the values (arguments) according to the status of the variable values.
based on my scenario I need to make a flexible mysql query ...
1
vote
0
answers
30
views
Unable to insert array and map data into the databricks table programmatically in python
Trying to insert array and map (dictionary/json) data into Azure databricks table using both SQLAlchemy as well as databricks-sql-connector.
getting differenet error
from sqlalchemy import ...
1
vote
2
answers
39
views
Unpack values from column, which consist of list of dictionaries
I have dataframe, which looks like this:
import pandas as pd
df = pd.DataFrame({"item_id": [1, 2, 3],
"item_properties":[
...
2
votes
2
answers
54
views
find value in column, which contains list and take another value from next column and put it in first table to new column
I have two tables
df1 = pd.DataFrame([{'a': 1}, {'a': 2}, {'a': 8}])
df1['b'] = ""
df2 = pd.DataFrame([{'e': [1,2,3], 'f': 1},{'e': [4,5,6], 'f': 2},{'e': [7,8,9], 'f': 3}])
e f
I ...
1
vote
1
answer
36
views
Can't access local dataframe from dictionary comprehension expression [duplicate]
I am using dictionary comprehension to compare each dataframe from within a dictionary to its corresponding dataframe in locals(). For some reason, I am getting a key error when accessing the locals()...
-1
votes
1
answer
46
views
How to merge two array using .map and .find by avoiding iterating twice
I have two arrays below. I am trying to merge conditions array based on customerLOB.code match. The problem is, I am getting the results added twice because the loop gets iterated twice. How can I ...
0
votes
1
answer
40
views
Need to edit values inside USX (XML) file based on a map
I have a special case, I want to adjust the chapter and verse numbers inside a USX file which is a special format of XML.
Documentation: https://ubsicap.github.io/usx/index.html
Here are the first 2 ...
0
votes
2
answers
33
views
make groups by a dictionary in R
I have the task of identifying the group to which a sentence belongs according to the use of specific words, for example identifying which color has been used to describe an animal. I have a ...