i have a question that might end up being a fairly simple fix but i am having a lot of trouble with it. I am making a program that will allow the user to pick between a list of text files that are all like this to search:mirar,buscar to play:jugar to be:ser,estar to run:correr to make:hacer to talk:hablar to …
Tag: dictionary
How can I print a single row element in Python DictReader
I’ve got a program to find DNA matches. We’ve been given a one line text file for finding the longest sequence of STR(Short Tandem Repeats) then match the result with a database which has been a .cvs file as below: After getting results for longest sequence amounts(as integer) I’m trying to …
how to build a tree for ordered numbers?
I am trying build a tree (dictionary ) from input numbers. My main criteria for the tree is all the nodes in a level are in a same range. ( a series of data from parent) I think you will get idea from my examples- Please see the example I tried to build a tree initially. This will work only
Сonvert list values to dictionary as key and value
Suppose there is a list: [‘1604780184′, ’10’, ‘1604780194’, ‘0’, ‘1604780319’, ’99’, ‘1604780320’, ‘0’] You need to get a result like: {‘1604780184′: ’10’, ‘1604780194’: ‘0…
Plot a Dictionary of Dataframes
I have a dictionary of dataframes (Di): For each df in Di, I would like to plot A against B in a single graph. I tried: But that gave me two graphs: How do I get them both in the same graph please? Answer You should print on a same ax:
Getting the max and min from a dictionary without using max() and min()
I have a dictionary with two values (id and amount): and I want to find the id with the max and min amount from the dictionary without using the max and min functions. So desired output is: Answer You could just calculate it with a for loop: If your values are lists, you need to chose what index to use
Browse a dynamic json that contains nested lists and dictionaries
I have multi-levels json files with nested list and dictionnary inside, they look like this, but vary in size, and levels: I’m trying to read the json and print every single key value combination. When I’m at the end of a nested list, I would like to execute a function, let’s say for the mom…
Get the number of specific dictionary values being stored in a 2-dimensional list in Python
I have a dictionary that contains fruits as keys and a 2-dimensional list including the line number and the timestamp, in which the fruit name occurs in the transcript file, as values. The 2-dimensional list is needed because the fruits appear several times in the file and I need to consider each single occur…
Sorting the values of a dictionary based on values of other dictionary
I have a dictionary that looks like this.. and I have another dictionary with some score like this.. I want to sort the values of “results” dictionary based on values of “score” dictionary. For example, For the key ‘agunii2035’, the score dictionary has values [ 4,4,1,3]. S…
Appending two lists with multiple dicts Python
I have five dictionaries dic1, dict2, dict3, dict4, dict5. I’m trying to append dict-keys to two lists list1, list2. Output The first three dictionaries are to be appended for both the lists and fourth dictionary dict4 to the list1 and fifth dict5 to the list2. So far I did in this approach, I’m l…