Data dodania Pytanie
2017-03-09 11:03 Sum values of similar keys inside two nested dictionary in python »
I have nested dictionary like this: data = { "2010":{ 'A':2, 'B':3, 'C':5, 'D':-18, }, ...
(4) odpowiedzi
2017-03-04 07:03 Data structure: Top K ordered dictionary keys by value »
I have a very large dictionary with entries of the form {(Tuple) : [int, int]}. For example, dict = {(1.0, 2.1):[2,3], (2.0, 3.1):[1,4],...} that cann...
(3) odpowiedzi
2017-03-03 18:03 Should I use a C# Dictionary if I only need fast lookup of keys, and values are irrelevant? »
I am in need of a data type that is able to insert entries and then be able to quickly determine if an entry has already been inserted. A Dictionary s...
(1) odpowiedzi
2017-03-02 15:03 Converting list to dict python »
Given a list: source = [{'A':123},{'B':234},{'C':345}] I need a dict from this list in the format: newDict = {'A':123,'B':234,'C':345} What is ...
(3) odpowiedzi
2017-03-02 11:03 Convert List of Object to Map with duplicate key »
I have a class that looks like this: case class Person(id : String, name : String, refId : String) {} And I have a list of Person. I want to have ...
(1) odpowiedzi
2017-03-01 21:03 Find unique (key: value) pair given N dictionnaries in python »
I would like to find an easy and/or fast way to find all common couple (pair: value) given N dictionnaries in python. (3.X would be best) PROBLEM Gi...
(3) odpowiedzi
2017-02-23 15:02 Why is the __dict__ of instances so small in Python 3? »
In Python, dictionaries created for the instances of a class are tiny compared to the dictionaries created containing the same attributes of that clas...
(1) odpowiedzi
2017-02-23 13:02 Haskell, print modified list values with map »
I have written the following code, which should take a list of values and print only the values > average, modifying them as val - avg. For example...
(1) odpowiedzi
2017-02-21 14:02 C# can't bind my model to razor TextBoxFor »
In my .cshtml file I have the following @model MyProject.MyViewModel.Range @for (int i = 0; i < Model.Range.Count; i++) { &l...
(2) odpowiedzi
2017-02-20 21:02 How to use map to lowercase strings in a dictionary? »
I'm experimenting around with the use of map, filter, and reduce in Python 3.6 at the moment. What I'm trying to do is, given a list of dictionaries, ...
(4) odpowiedzi
2017-02-16 21:02 Python - something faster than 2 nested for loops »
def fancymatching(fname1, fname2): #This function will do much smarter and fancy kinds of compares if (fname1 == fname2): return 1 els...
(2) odpowiedzi
2017-02-14 23:02 How to convert this text file into a dictionary? »
I have a file f that looks something like: #labelA there is something here #label_Bbb here aswell ... It can have a number of labels and any number...
(7) odpowiedzi
2017-02-14 09:02 What's the correct way to create a dictionary typealias? »
If I want to define a typealias for a Dictionary, which accept String as the key, and String for the value, but I also want it to can accept nil, whic...
(2) odpowiedzi
2017-02-13 11:02 Order of operations in a dictionary comprehension »
I came across the following interesting construct: assuming you have a list of lists as follows: my_list = [['captain1', 'foo1', 'bar1', 'foobar1'],...
(4) odpowiedzi
2017-02-07 17:02 Python: Map a function over recursive iterables »
I have an arbitrarily nested iterable like so: numbers = (1, 2, (3, (4, 5)), 7) and I'd like to map a function over it without changing the structu...
(2) odpowiedzi
2017-02-07 12:02 Order a dictionary based on specific values »
Before writing a function, I would like to be sure there is no pre-built (optimized) solution (like sorted()) that can: From a dictionary like this o...
(2) odpowiedzi
2017-02-01 19:02 Processing dictionary keys in arbitrary order »
I want to transform dictionary into a string. What would be beginner-level question is complicated by few rules that I have to adhere to: There is a...
(4) odpowiedzi
2017-02-01 15:02 Create array with key from dict with sorted by dict values »
I have an dictionary that I want to iterate trough in a tableview. One way of doing this is to create an array with all the keys and just fetch the ke...
(4) odpowiedzi
2017-01-27 11:01 Corresponding Dictionary Keys and Values Outputs »
As a dictionary is not ordered the output is also not ordered: >>> d = dict(b = 1, a = 2, z = 3) >>> d.keys() ['a', 'z', 'b'] >&...
(1) odpowiedzi
2017-01-22 19:01 Extract information from dictionary.description? »
I have a quiz app that is based on a structure containing a Question and Answer components. Users can flick through the questions. Is done by just sel...
(1) odpowiedzi
2017-01-22 14:01 Identifying the values which have the maximum number of keys »
I have a dict which goes something like this: ip = { "1" : ['a','b'], "2" : ['a','c'], "3" : ['a','b','c','d'], "4" : ['a','b','d'...
(2) odpowiedzi
2017-01-17 14:01 Executing functions within switch dictionary »
I have encountered a problem when putting all the modules I've developed into the main program. The switch dictionary I've created can be seen below: ...
(3) odpowiedzi
2017-01-15 16:01 GoLang for changing order »
When I execute the code bellow in the sandbox (https://play.golang.org/p/LpOGMsl7W1) and on my PC - i see different array key order. My PC (windows) s...
(1) odpowiedzi
2017-01-14 18:01 jQuery | .css() Multiple Parameters '-' Error »
I have a problem with the .css({}) function in jQuery: I don't know exactly how this function behaves, except for that I understood that I can insert ...
(2) odpowiedzi
2017-01-11 10:01 Ordering dictionary in context Django »
I looked at this thread, with an example of sorting dictionaries. I have a dictionary of programme objects where the key is a programme object and th...
(2) odpowiedzi
2017-01-10 11:01 How to access all dictionaries within a dictionary where a specific key has a particular value »
I have a dictionary of dictionaries, with each nested dictionary having the exact same keys, like this: all_dicts = {'a':{'name': 'A', 'city': 'foo'}...
(4) odpowiedzi
2017-01-09 18:01 Is there a clean test for a dictionary element in Python? »
If I have an element I'm trying to get from a dictionary: my_dict[i]['level_1']['level_2']['my_var']. Is there a cleaner way than doing this to check...
(2) odpowiedzi
2017-01-08 09:01 I'm trying to count all letters in a txt file then display in descending order »
As the title says: So far this is where I'm at my code does work however I am having trouble displaying the information in order. Currently it just d...
(4) odpowiedzi
2017-01-07 07:01 Append to array in [String: Any] dictionary structure »
Assembling a data payload passed to GRMustache.swift for rendering mustache templates, I'm in a scenario where I need to append data to an array previ...
(3) odpowiedzi
2017-01-04 21:01 multi nested dictionary from tuples in python »
I have this list of tuples list_of_tuples = [('0', '1'), ('1', '1.1'), ('1', '1.2'), ('1', '1.3'), ('1', '1.4'), ('0', '3'), ('3', '3.1'), ('3', '3.2...
(2) odpowiedzi
2017-01-04 07:01 How to integrate offline Dictionary with synonyms in android app »
I want to show word meaning and synonyms (offline) on long press on any word, which means that integrating an offline Dictionary with synonyms in my a...
(0) odpowiedzi
2017-01-01 03:01 In Python, why do separate dictionary string values pass "in" equality checks? ( string Interning Experiment ) »
I am building a Python utility that will involve mapping integers to word strings, where many integers might map to the same string. From my understan...
(1) odpowiedzi
2016-12-28 13:12 Can I have an array of objects with a custom toString in JavaScript? »
I've got an array of objects. (Use case might be solitaire cards). I want to embed a toString for debugging them. I'm using the following (simplif...
(1) odpowiedzi
2016-12-21 22:12 Iterating over a dictionary to create a list »
I have the following 4 dictionaries in a MongoDB collection called favoriteColors: { "name" : "Johnny", "color" : "green" } { "name" : "Steve", "colo...
(3) odpowiedzi
2016-12-21 03:12 Explode a dict - Get all combinations of the values in a dictionary »
I want to get all combinations of the values in a dictionary as multiple dictionaries (each containing every key of the original but only one value of...
(2) odpowiedzi