Data dodania Pytanie
2017-10-08 17:10 Multiples-keys dictionary where key order doesn't matter »
I am trying to create a dictionary with two strings as a key and I want the keys to be in whatever order. myDict[('A', 'B')] = 'something' myDict[('B...
(2) odpowiedzi
2017-10-08 04:10 Override dict() on class »
I'm trying to make a dict-like class in Python. When you make a class, you have certain methods that tell Python how to make a built-in class. For ex...
(2) odpowiedzi
2017-10-07 21:10 How to map using multiple variables in python? »
I need help with this, I have a list of lists and a list of dictionaries. The list of dictionaries has for its values, list of indexes that point to ...
(1) odpowiedzi
2017-10-06 20:10 creating dictionary from the list with each elements as key:value pairs in python »
I have a list where the content of list are key:value pairs something like shown below sample =['ldb:21', 'baseB:4', 'cache-6:55', 'Xauthority:1', '...
(4) odpowiedzi
2017-10-04 09:10 collection of key-value pairs where key depends on value »
I have a class MyClass class MyClass { public string Name { get; set; } // is unique among all instances public SomeClass Data { get; set; } ...
(2) odpowiedzi
2017-10-02 15:10 Pickle a dict subclass without __reduce__ method does not load member attributes »
I have the need to ensure that a dict can only accept a certain type of objects as values. It also have to be pickable. Here is my first attempt: ...
(1) odpowiedzi
2017-09-26 12:09 Multiple orderings on single sets or maps - how can this be achieved in Java 8? »
There is some probability that this question might be a duplicate, however, I have not found a satisfiable answer yet: I have a set (in the meta sens...
(0) odpowiedzi
2017-09-22 00:09 How do I create an Or condition on a dictionary of elements in Python? »
dict = {a:[1,2,3,4], b:[4,5,6]} I would like to create a function func1 that takes in a dictionary as an argument def func1(dict, elem1, elem2): ...
(1) odpowiedzi
2017-09-21 16:09 How to make a list of integers that is the sum of all the integers from a set of lists in a dict? »
Let's assume I have a created a dict that is made up of n keys. Each key is mapped to a list of integers of a consistent length. What I want to make ...
(2) odpowiedzi
2017-09-18 16:09 Check if line is a dictionary type and print the data? »
I have .txt file and its loaded with a lot of text but in between 2-3 paragraphs there is a text like dictionary: somerandomtextinthisline {"key1":"v...
(2) odpowiedzi
2017-09-16 14:09 Multiprocessing pool: How to call an arbitrary list of methods on a list of class objects »
A cleaned up version of the code including the solution to the problem (thanks @JohanL!) can be found as a Gist on GitHub. The following code snipp...
(1) odpowiedzi
2017-09-15 12:09 Splitting list of dictionary into sublists after the occurence of particular key of dictionary »
I have list of dictionaries. These dictionaries basically have just one key-value each. For example: lst = [{'x': 23}, {'y': 23432}, {'z': 78451}, ...
(5) odpowiedzi
2017-09-11 19:09 Best Data Structure for fast retrival, update, and keeping ordering »
The problem is as follows I need to keep track of url + click count. I need to be able to update url quickly with click count when user click on tha...
(5) odpowiedzi
2017-09-08 04:09 REVISED WITH COMMENTS v1: Multiprocessing on same dict/list »
I am fairly new to python, kindly excuse me for insufficient information if any. As a part of the curriculum , I got introduced to python for quants/f...
(2) odpowiedzi
2017-09-08 02:09 Dictionary value as function to be called when key is accessed, without using "()" »
I have a dictionary that has values sometimes as strings, and sometimes as a functions. For the values that are functions is there a way to execute th...
(4) odpowiedzi
2017-09-07 22:09 Convert nested PHP Array to nested Python Dictionary »
I have a PHP script and want to write that in Python. So, How can I convert this nested PHP Array to nested python dictionary? $data = [ 'details...
(2) odpowiedzi
2017-09-06 16:09 Python dict with values as tuples to pandas DataFrame »
I have the following dict: td = {'q1':(111,222), 'q2':(333,444)} I would like to convert it to a dataframe that looks like this: Query Value1 ...
(4) odpowiedzi
2017-09-05 11:09 Scala map and groupby a Map to another Map, with a smaller keyset »
Lets say there is a Scala Map, eg: val map:Map[String, List[String]= Map("Apple" -> List("Red", "Tasty"), "Orange" -> List("Sour", "Orange"), ...
(4) odpowiedzi
2017-09-03 01:09 2 Dimension Array in ColdFusion »
I'm trying to have a 2 dimension array in ColdFusion or a dictionary. I'm reading from the database: <cfquery name="getData" datasource="myDB"&gt...
(2) odpowiedzi
2017-09-01 18:09 Poor use of dictionary? »
I've read on here that iterating though a dictionary is generally considered abusing the data structure and to use something else. However, I'm havi...
(3) odpowiedzi
2017-09-01 17:09 Ruby -- convert a nested hash to a multidimensional array »
I have a hash which is named h. I want to store the contents in a multidimensional array named ar. I am getting the error no implicit conversion from ...
(4) odpowiedzi
2017-08-31 13:08 Projecting variables in python when applying the map function »
Is it possible to project the second argument of the inner function when mapping across a set of items in Python? when using map with the monadic use...
(3) odpowiedzi
2017-08-31 12:08 Fastest way to increment counters in dictionary »
What would be the fastest way to increment counters stored in a dictionary? Because I have to do this same operation hundreds of thousand of times, I...
(1) odpowiedzi
2017-08-31 10:08 Inheritance in a configuration dict »
What I want From a yaml config I get a python dictionary that looks like this: conf = { 'cc0': { 'subselect': {'roi_spectra...
(1) odpowiedzi
2017-08-25 16:08 Is it always safe to modify the `**kwargs` dictionary? »
Using the Python function syntax def f(**kwargs), in the function a keyword argument dictionary kwargs is created, and dictionaries are mutable, so th...
(3) odpowiedzi
2017-08-22 07:08 How to remove the keys of a dictionary where the values are null in swift 3 »
Hi I need to remove the dictionary keys which is having no values .I tried many codes but not working .I only need the dictionary with keys which hav...
(2) odpowiedzi
2017-08-17 14:08 Swift 4 collection of Codable objects »
I have a Codable class with a variable that holds a dictionary with String keys and values that may be Strings, Ints or custom structs conforming to C...
(2) odpowiedzi
2017-08-15 21:08 Ensuring that two separate objects have a unique total set of keys »
I have a JS framework (yes I know lol) and the user can inject values sourced from two different files. The injectable values are identified by the ke...
(3) odpowiedzi
2017-08-05 16:08 Why python dict.keys() order will change every time when the key is class object? »
The output of keys() order will change each time when key is class object. class test: def __init__(self, path): self.path = path de...
(1) odpowiedzi
2017-08-04 14:08 cpython 3.6 dict order in dict comprehension »
Since in CPython 3.6 dicts are ordered (I know it's not guaranteed - yet awesome to use), so I expected the following dict comprehension to preserve t...
(1) odpowiedzi
2017-08-03 12:08 How to convert returned array to dictionary with Swift 3 »
I'm using FB API to get the list of user's page likes. But i'm stuck with converting array (the array is the return data from FB API) to dictionary. ...
(1) odpowiedzi
2017-08-02 20:08 Sort dictionary into list »
There are already a lot of questions about sorting dictionaries but I can't find the right answer to my question. I have the dictionary v: v = {3:4...
(7) odpowiedzi
2017-08-02 13:08 Should I use put() or putIfAbsent() after using getOrDefault()? »
Java8 introduced those nice methods getOrDefault() and putIfAbsent(), allowing to write code like: Map<Foo, List<Bar>> itemsByFoo = ... L...
(2) odpowiedzi
2017-08-02 01:08 is there a way to add in more dict after inside an append? django »
Apologize if the title is a bit hard to understand. Not too sure how to explain it within a line. What I want to do is... actually I have this code ...
(2) odpowiedzi
2017-08-01 17:08 create a dictionary with incrementing values »
I have a list and I want to generate a dictionary d taking out duplicates and excluding a single item, such that the first key has value 0, the second...
(5) odpowiedzi