All Questions
Tagged with python-3.x dictionary
8,638
questions
0
votes
0
answers
13
views
json.dump() adding backslash when double quotes are added in python dictionary
I'm reading data from excel have say proxid as field which contains Multi-values ie.
proxid --> ABC-123,PQR-456 (data seperated from comma)
My task is to read the data and convert this data in ...
0
votes
0
answers
49
views
How to take a Python Dictionary and Put Data Into Existing PDF?
I have code where I'm taking fields from a PDF, turning them into a list, and then into a dictionary. (I'm not sure if fields->list->dictionary is necessary or if fields->dictionary makes ...
0
votes
2
answers
52
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
1
answer
54
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 ...
0
votes
1
answer
29
views
How to create extended dict Class requiring key/values on get()
I'm trying to build a custom class that will require keys and/or values when getting them from a dict. This is a simple version of what I have written, getRequired and is only checking for keys.
class ...
-1
votes
1
answer
66
views
tensorflow.python.framework.errors_impl.FailedPreconditionError: C:\Users\Ata Onur Özdemir\PycharmProjects\Emotion_Detection\output is not a directory
This is a sample Sentimental Analysis code for hotel reviews like positive or negative. I use pandas, transformers, datasets, turkish_lm_tuner libraries. Firstly, I think Path name (C:\Users\Ata Onur ...
3
votes
2
answers
63
views
Collect values as dictionary in parent column using Pyspark
I have code and data like below:
df_renamed = df.withColumnRenamed("id","steps.id").withColumnRenamed("status_1","steps.status").withColumnRenamed("...
1
vote
1
answer
63
views
How to properly sort a nested dictionary by keys in Python3, where we take in account numbers from key strings
Assuming a dictionary that looks like this, where we have a string with some number for the key (not necessarily in any order, nor is it guaranteed that it would be in a continues sequence, and the ...
-3
votes
3
answers
101
views
How to get last N items from dict? [closed]
I have a dict like this:
dict_ = {
'abc': 1,
'bcd': 2,
'cde': 3,
'def': 4
}
I need to iterate only last N items in dict with for k, v in dict.items(), how to do that? If that was list, I ...
-1
votes
1
answer
45
views
Is there a way to take a lists first element of a list and make it the first items key and second element make it the first items value in python
I have come across a small problem when working on a particular programming exercise
In this exercise I am supposed to get data from a file which contains world series winning teams
example something ...
2
votes
1
answer
27
views
Python giving different response when called via async
Getting different output for the same logic?
Was trying to learn async/await in python.
Output for first Snippet : <class 'dict'>
Output for second Snippet : <class 'list'>
Snippet 1 : ...
0
votes
0
answers
14
views
Returning a subset of a nested dictionary - Returns None [duplicate]
I'm trying to create a function that take a nested dictionary and returns a subset/item depending on the path provided as an ordered tuple. I'm using a circular reference of the function to iterate ...
-1
votes
4
answers
58
views
Write file extensions and their occurrences in a list into a dictionary?
How can I solve this with loops, without regular expressions?
Write a function that accepts a list of file names and returns a dictionary with extensions as keys and their occurrences as value.
...
-1
votes
1
answer
45
views
TypeError: not all arguments converted during string formatting in dictionary key value
a = input("enter the message")
a = list(a)
b = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j&...
0
votes
1
answer
26
views
pulling specific values from nested dictionary
i am currently writing an automation script using the nmap3 python library, but im stuck pulling values out of a nested dictionary, the idea is to pull all data related to the open ports found within ...