Data dodania Pytanie
2017-06-18 05:06 How to extend Scala Maps: implementing get and iterator »
I'm making a custom SparseMatrix in Scala as an exercise. I want to do this by extending the immutable map. The functionality should be something like...
(0) odpowiedzi
2017-06-16 20:06 Can I change the way keys are compared in a Python dict? I want to use the operator 'is' instead of == »
Let's say I have two objects of a same class: objA and objB. Their relationship is the following: (objA == objB) #true (objA is objB) #false ...
(2) odpowiedzi
2017-06-16 16:06 Dictionary initializer has different behavior and raises run-time exception when used in combination of array initializer »
I have the following C# code which initializes a new dictionary with int keys and List<string> values: var dictionary = new Dictionary<i...
(2) odpowiedzi
2017-06-16 02:06 What is the most pythonic way to re-order a class objects' attributes? »
I'm in the process of creating a set of Python 2.7/3+ tools to programmatically modify the contents of XML files my team uses constantly. So far, I'm ...
(2) odpowiedzi
2017-06-15 13:06 Understanding the max function operation on Python dictionary »
I am trying to understand the operation on max function on Python dictionary. Following is the code I am using: tall_buildings = { "Empire State...
(3) odpowiedzi
2017-06-14 08:06 How to make a dictionary of dictionaries with multiple lists »
There is one index list which will be the key of the parent dictionary: index = [1,2,3] and then multiple lists of which will be the child dicts: ...
(7) odpowiedzi
2017-06-13 22:06 When does __eq__ gets called using hash()? »
As mentioned here, Below code, class Person(object): def __init__(self, name, ssn, address): self.name = name self.ssn = ssn ...
(2) odpowiedzi
2017-06-13 12:06 Add Dictionaries Keys Values to Array [JavaScript] »
Here is a sample of my data structure in JavaScript: var list = [{"username":"admin1"}, {"username":"admin2"}, {"username":"admin3"}, {"username":"a...
(2) odpowiedzi
2017-06-07 20:06 A dictionary with a unique possible value for each key? »
I need to create a map from twitter status IDs to their author ID. Obviously, each status has exactly one author. I expected Python collections to ha...
(0) odpowiedzi
2017-06-07 05:06 In c# , how to iterate IEnumerable in multithreading environment »
I am in this situation that there is a large dictionary that is randomly updated by one thread at a fairly high frequency, and there is another thread...
(3) odpowiedzi
2017-06-01 10:06 How can I filter a dictionary with arbitrary length tuples as keys efficiently? »
TL;DR What is the most efficient way to implement a filter function for a dictionary with keys of variable dimensions? The filter should take a tuple...
(4) odpowiedzi
2017-05-31 13:05 Convert type X to Y in Map<K, Map<V, X>> using Java Stream API »
I want to convert inner map from map of maps. Old map: Map<String, Map<LocalDate, Integer>> Integer means seconds New map: Map<String...
(9) odpowiedzi
2017-05-30 22:05 Searching for dictionary keys contained in a string array »
I have a List of strings where each item is a free text describing a skill, so looks kinda like this: List<string> list = new List<string&gt...
(4) odpowiedzi
2017-05-29 06:05 Python : Can Dictionary be used for indexing? »
This is my first question on StackOverflow and I have searched so many websites but couldn't find what I was looking for (or didn't notice). Please do...
(4) odpowiedzi
2017-05-28 07:05 How to return the same order in dict - django python »
I try to build a dict with variables inside. The variables build another dict in the parent dict. for example: json_out = { "articles":{ ...
(0) odpowiedzi
2017-05-25 15:05 Swift 3 - Filter and sort array of dictionaries, by dictionary values, with values from array »
I am trying to implement the following behavior in an elegant way: Reorder users by the id in userIds and filter out all users whose id isn't in u...
(3) odpowiedzi
2017-05-23 18:05 Errors referring to type "_": "Cannot assign value of type '[Value]' to type '_?'" »
I'm trying to merge two Dictionary objects. When they both have a value for a key, I would like the second Dictionay's value to overwrite the first, w...
(1) odpowiedzi
2017-05-19 15:05 Java Generics - Mixed Object Maps »
I'm still getting used to Java Generics however I'm currently in the process of updating an application written prior to generics to use the latest ve...
(6) odpowiedzi
2017-05-12 05:05 does mongodb maintain key order in a dictionary inside a document? »
I have two collections, both holding a very similar document. The document in each collection contains a key called 'users'. 'users' is a dictionary. ...
(0) odpowiedzi
2017-05-07 04:05 Python loop optimization »
I am currently working with a file with more than 2 million lines. I've separated the lines into lists of elements (ex: [a,b,c,d] = 1 line, words sepa...
(1) odpowiedzi
2017-05-06 15:05 How to elegantly check if a dictionary has a given structure? »
I have a dictionary with the following structure: D = { 'rows': 11, 'cols': 13, (i, j): { 'meta': 'random string', ...
(5) odpowiedzi
2017-05-04 11:05 Create two dictionnaries from one single iterator »
I need to create two dictionnaries while reading input from one generator. I am concerned with the fact that both dict and the data only need to be sc...
(1) odpowiedzi
2017-05-01 20:05 Storing and accessing object array in dictionary - Swift 3 - macOS »
So I'm not 100% sure if this is even the right way about this but I have a class that stores a few variables, I then have an array that stores theses ...
(2) odpowiedzi
2017-05-01 09:05 Python3, ordering a complex dict »
I've got a complex Python dictionary that stores the following values: MAC ADDRESS, RSSI and TIMESTAMP: beacons_detected = { '55:c1:9a:41:4c:b9':...
(2) odpowiedzi
2017-04-29 05:04 c# how to order this dictionary »
I have this dictionary Dictionary<int, Dictionary<string, SortedSet<string>>> events = new Dictionary<int, Dictionary<string...
(2) odpowiedzi
2017-04-26 02:04 Creating Process Dictionary »
My Goal: I need to create a function that retrieves the PID and Name of each process and returns them in a dictionary. I will be uploading this to Dja...
(1) odpowiedzi
2017-04-20 10:04 C# - Adding objects that implement interfaces to a dictionary »
I have a dictionary: private Dictionary<Type, IExample> examples; I have two classes that implement the interface: public class Example1 : I...
(5) odpowiedzi
2017-04-16 01:04 if/else statements vs dictionary »
If I were to write a statement using dictionary instead of an else statement, how would that be? For example, say I have def determineRank(years): ...
(3) odpowiedzi
2017-04-15 02:04 Scala immutable Map vs List of tuples »
What's the difference between an immutable Map and a List of tuples in Scala? When should I use each of them? Which one is preferable if both are poss...
(2) odpowiedzi
2017-04-14 14:04 Given a text count occurrences of all two consecutive words »
Input: Once upon a time a time this upon a Output: dictionary { 'Once upon': 1, 'upon a': 2, 'a time': 2, 'time a': 1, ...
(3) odpowiedzi
2017-04-10 00:04 Performance is slow when replacing a string in a pandas dataframe using a dict »
The following code works but needs to run faster. The dict has ~25K keys and the dataframe is ~3M rows. Is there a way to produce the same results but...
(3) odpowiedzi
2017-04-09 12:04 How to convert nested dictionary to dataframe? »
I've got a nested dictionary. It's some Nasdaq kind of data. Like this: {'CLSN': Date Open High Low Close Volume Adj Close ...
(2) odpowiedzi
2017-04-09 02:04 Comparing values of two dicts in Python »
I have 2 dictionaries: budgets = {'Engineering': 4500.0, 'Marketing': 5000.0, 'Operations': 3000.0, 'Sales': 2000.0} spending = {'Engineering': ...
(4) odpowiedzi
2017-04-08 00:04 Python: Dictionaries and how they are stored and accessed with iteritems() »
I wanted to clarify some points about dictionaries in Python, which may help some other Python enthusiasts in the future. Let's start with a simple d...
(2) odpowiedzi
2017-04-05 11:04 Nested list to dict »
I try create dict by nested list: groups = [['Group1', 'A', 'B'], ['Group2', 'C', 'D']] L = [{y:x[0] for y in x if y != x[0]} for x in groups] d = {...
(4) odpowiedzi