86,292 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
2
votes
1
answer
26
views
why bounds in fitbounds of leaflet are not valid?
I have this map:
<l-map
ref="mapRef"
:use-global-leaflet="false"
>
and wanted to fit the map based on bounds which calculated in this way:
bounds.extend([lat, lng]);
...
Advice
1
vote
6
replies
101
views
How do I get specific values from specific keys in dictionary?
I have made a dictionary and a list of dictionaries but I am not sure how to get specific data from the different forms. I tried using '.startswith('7') but always gives me an error. I want to get the ...
2
votes
1
answer
100
views
Using csv how to write into file, list of dictionaries that sometimes have list inside them?
I need to create list from CSV file (it data is movies information like title, director, and actors. Directors and actors are list while other data is just string) it look like this:
with open('filmy....
-3
votes
2
answers
147
views
How do I consolidate an object of arrays of timestamped values into single array of objects? [duplicate]
I need to aggregate all the timestamped values into their sums. (Please note data may be missing for a specific log at specific timestamp.)
I have this:
const logs = {
log_1: [
{ x: "...
-3
votes
1
answer
107
views
Can't directly update a dict deepcopy [closed]
I can update a deepcopy of a dictionary in two steps. But when I try to make it a single step it returns None.
from copy import deepcopy
d0 = {'a': 1}
d1 = deepcopy(d0)
d1.update([('b', 2)])
print(d0,...
Advice
0
votes
8
replies
184
views
Finding the max values for list values for each key in a dictionary without using max()
Let's say I have a dictionary such as:
dict = { "Mars": [4, 3, 4, 7, 10], "Jupiter": [6, 6, 7, 9, 11], "Saturn": [4, 5, 12, 22, 1]}
I would like to iterate through each ...
0
votes
1
answer
146
views
Trying to create a Map in C++
I am trying to create a map of stringstreams in C++
std::map<int, std::stringstream> myMap;
std::stringstream ss;
myMap.insert(std::pair<int, std::stringstream>(1, ss));
This fails to ...
1
vote
3
answers
189
views
How to get and update multiple values with multiple keys in a dictionary with vb.net [duplicate]
I have a populated dictionary Test with two keys in TestKeys and five values in TestValues all created via structure objects:
Structure TestKeys
Public Key1 As String
Public Key2 ...
Advice
2
votes
6
replies
88
views
How to model a deep inheritance in F# and allow all items to be added to an inventory
Referring to the attached diagram for an example hierarchy of materials, how can I represent this in F#? Once represented I need to be able to add ANY/ALL of the materials in level 4 (L4) of the ...
4
votes
3
answers
223
views
How to sort a dictionary of word counts by value while preserving the original key order? [duplicate]
I am trying to count word frequencies in a text and then sort them in descending order of frequency. So if two words have the same frequency, they should remain in the same order they first appeared ...
-3
votes
1
answer
195
views
How to create a dictionary where the keys are the alphabet (A-Z), and values are a letter from a string in Python?
I have to create a dictionary, where the keys are letters of the alphabet, and the values are the indexed letters of a given string.
Example:
Given the string "BDFHJLCPRTXVZNYEIWGAKMUSQO" ...
2
votes
1
answer
224
views
Are the iterators of `map<key, value, greater<>>` and `map<key, value, less<>>` guaranteed to be the same type?
I have 2 maps
using BidBook = std::map<float, int, std::greater<>>; // price -> qty
using AskBook = std::map<float, int, std::less<>>;
I have a struct that contain iterator ...
1
vote
3
answers
90
views
How do I make a list in dictionary
This is my simple code for noting down dreams from Python crash course practices 10.7
In this practice I tried to make a list of dreams instead of simply adding a value to key
but don't how to make a ...
0
votes
1
answer
95
views
Using std::map to look up function handlers [duplicate]
I am trying to use std::map to map numerical IDs to function handlers: All function handlers take two integers and return an integer. Handler 100 would calculate the product.
When preparing the map, ...
Advice
0
votes
9
replies
142
views
Pythonic way to obtain dictionary keys with desired property
In python 3.12 I have a dictionary of which the keys are 2-tuples of integers and of which the values are integers (as in the function f:N ×ばつ N → N for which f(n, m) = n + m). What I need is those keys ...