As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [key-value]

A key-value pair is a set of two linked data items: a key which uniquely identifies some item of data, and the value, which is either the data that is identified or a pointer to the location of that data. Key-value pairs are frequently used in lookup tables, hash tables and configuration files.

Filter by
Sorted by
Tagged with
0 votes
4 answers
65 views

Split array object to nested array for each separator

I am trying to split the below array { "Base/Brand/0101-color-brand-primary-red": "#fe414d", "Base/Brand/0106-color-brand-secondary-green": "#00e6c3", ...
Sanjeev Hegde's user avatar
0 votes
1 answer
38 views

Rearranging Duplicate Values in a Hashmap pairs in ascending Key order

I want to write a piece of code in java that takes in an hashMap that is sorted in descending values. It only rearranges the pairs that have more than one duplicate values and order them in ascending ...
Teoman Selcuk's user avatar
0 votes
0 answers
28 views

How to replace hard coded value with dynamic input variable in the outputs - Github actions

Harded code value app_name was here and it worked fine -> app_namexx: ${{ steps.run-script.outputs.app_name }} I now wish to replace hard coded app_name to input variable key_name. So, Tried ...
Ashar's user avatar
  • 2,850
-1 votes
0 answers
26 views

How can I store multiple checkbox values in Laravel database using different fields? [closed]

I want to store multiple checkbox value in database with different fields. Use Laravel I have tried using this in my controller but it still doesn't insert the data in the database, am I doing ...
Berlina Shobirah's user avatar
0 votes
0 answers
18 views

Why does Postman "form-data" body send differently than "raw>JSON" body?

When I make a simple POST to my local intake endpoint, I can create a lead with the following very simple raw JSON body inside Postman: { "identification_first_name": "New", ...
Andrew Steven's user avatar
0 votes
1 answer
44 views

How to obtain nested object correctly from NgForm?

I need to obtain keyvalue correctly from ngForm. I have a User interface in Angular like this: export interface User { id: int; name: string; surname: string; school: School; } And School ...
Carlac's user avatar
  • 11
2 votes
3 answers
58 views

Neater way to create an object

I am creating an object with values from an api response. Is there a neater way to do this? My code: const variables = { name: result.data.data.table.name, org: the_org, val1: result.data....
nb_nb_nb's user avatar
  • 1,175
0 votes
0 answers
13 views

Storing terabytes of records with minimum overhead

I need to store an enourmous (billions) amount of data in Key->Value kind of table. each key is 8 bytes and value is 32 bytes. From my calculations, I need around 40 TB for the storage alone. Let's ...
user37741's user avatar
  • 370
-1 votes
0 answers
24 views

Transform object to array of objects [duplicate]

I receive from API object and I can't transform: example: { 'joe': [{'a': 1, 'b': 2 },{'a': 3,'b': 5}], 'doe': [{'a': 12,'b': 22},{'a': 33,'b': 53}], } FinalArray: [ ...
Mike's user avatar
  • 11
0 votes
0 answers
25 views

How can I quickly extract values from key-value pair vector in R?

I am new in R and I have some problems. I have key-value pair vector kv_vect which contains lots of pairs: > length(kv_vect) [1] 296538 > head(kv_vect, 5) [[1]] [1] 3209 [[2]] [1] 234 [[3]] [1]...
alxdid5's user avatar
0 votes
1 answer
20 views

How to use a key from source JSON as a value in the output using JSONata?

I have JSON data where the keys are dynamic and I want to use these keys as values in my output. For example, consider the following JSON as source: { "skills":{ "Axel":[ ...
Akshit's user avatar
  • 5
2 votes
1 answer
36 views

read key value from xml using powershell

I wish to read the below xml values for a given key in a secure encrypted manner using powershell. So, for example, a given key port it should print the value 8814 Likewise for app_name it should ...
Ashar's user avatar
  • 2,850
0 votes
3 answers
54 views

Creating a new column of a data frame using a dictionary with partial string matching

I'm new to coding and any help would be appreciated. Function should take a pandas dataframe as input. Extract the city from a tweet using the has_Dict dictionary given below, and insert the result ...
Phillippa's user avatar
0 votes
1 answer
36 views

I am trying to take user inputs and put them into a dataframe via a dictionary, but I get a "Length of values does not match length of index error

I'm currently using the Streamlit library on python to make a webapp for one of my projects that will take user input data from interacting with sliders. However, when I try to store the user input ...
Hyun Jong Lee's user avatar
-2 votes
2 answers
61 views

How do I update a value of a key in a list of dictionaries in python?

I have following dictionary, result = [{'Img Entropy': 0.4759365334486925, 'Avg Row Entropy': 0.4756050513785311, 'Comp Size, B': 9675063, 'COMP RATIO, out/in': 0....
shparekh's user avatar
  • 806
0 votes
3 answers
83 views

Python txt file into key value pair

race, football, badminton yellow, 10, 20 white, 50, 30 red, 80, 100 I have a data similar as above (which is more complex). I wish form the key value pair where the result is as below: 'yellow': {'...
Joe's user avatar
  • 1
2 votes
1 answer
46 views

When TValue of Dictionary<,> is ValueTuple, does it mean that the Value of an item in the dictionary can no longer be modified once intialized?

(.NET 4.8 / C# 7.3) var test = new Dictionary<string, (int, string)> { { "a", (0, "A") } , { "b", (1, "B") } , { "c", (2, "C&...
Jyunhao Shih's user avatar
  • 1,257
2 votes
0 answers
24 views

Keys-Values Iteration in TypeScript Type [duplicate]

So I was making a cache manager with global cache object and I have its global object that will have "cached items", where the key of the property is "cached item name" and value ...
shadowplay1's user avatar
1 vote
0 answers
15 views

most recent timestamp in LevelDB

I’m using LevelDB as a database for a project I’m working on. My key format looks like users!5!pages:1682795409. Thereby "!" serves as separator and the last part of the key is a timestamp. ...
MrCoinSiX's user avatar
  • 551
0 votes
0 answers
20 views

How can I separate a data that I have broken as a key value again according to the -> sign?

If there is a -> sign, I want to separate the data that I have broken as a key value and take the left part as key and the remaining part as value. How can I shred favoriteInterestKeys? List<...
likepickle's user avatar
-3 votes
1 answer
51 views

Sort a Javascript Map by value numerically [duplicate]

If kv is a Javascript Map object, how can I sort it by its value numerically? This is, for example, a common pattern when kv is a counter, and we need to see the top-n items with the highest count. ...
SRobertJames's user avatar
  • 8,128
0 votes
2 answers
39 views

Optimized JavaScript Random Strings With Key-Value Pairs/For Loop

var crustType = ["wheat", "hand tossed", "deep dish"]; var crustTypeArr = crustType[Math.floor(Math.random() * crustType.length)]; var sauceType = ["marinara", &...
narutocoder789's user avatar
1 vote
1 answer
29 views

Interface Entry does not have constructors

I'm trying to make edits for multiple contacts depending on the user's contacts saved by countries. But, when trying to access the entry of the map, the warning below appears. Thank you... Interface ...
Mahmoud Nabil's user avatar
-1 votes
1 answer
59 views

return a series of keys based on value python randomly generated in separate line

I'm trying to return a series of values when randomly generating a number which then corresponds to a certain key. This is a miniature version of my dictionary (key = word, value = character count) : ...
a0126's user avatar
  • 1
-1 votes
1 answer
48 views

Getting values of particular key in a nested object structure in TypeScript

I have a n-level nested object where I have to get all the unique values for the key 'field'. Is there a way to get all the unique values for keytype 'field' in TypeScript. output = ['TierLevel', '...
Shashikumar N's user avatar
-1 votes
1 answer
23 views

how to iterate over string and capture specific fields from string

I am working on script that will capture specific fields from below string. can anyone please help? Thanks in advance! Want to capture QUEUE name which is SYSTEM.RETAINED.PUB.QUEUE, DEPTH, CURFSIZE ...
KhalDrogo's user avatar
0 votes
2 answers
50 views

Nested Objects into Arrays into an Object

I would need help to access the value of a key-value pair from an object that is itself nested into an array (several objects with 2 key-value pairs inside an array Several arrays into an object). So ...
Donut's user avatar
  • 23
0 votes
1 answer
60 views

In DynamoDB, are partition key access faster than composite key?

I have a use case where my model has couple of attributes. Each model can be uniquely identified by an OrderId and a Version. The no.of versions for 1 OrderId is not much, on an average 2-3 versions ...
Zeeshan Shamsuddeen's user avatar
0 votes
1 answer
88 views

Accessing a Document that have a Field of Map in firestore

I would like to ask on how to access the key value pair in field in firestore via nextjs isReferralAvailable. The key TESTER1and a boolean value of true I want to display them in a table or just ...
flutternewbiee's user avatar
0 votes
0 answers
15 views

how do i add change the value of a key value pair if i dont have the name of the key [duplicate]

const itemBtns = document.querySelectorAll('[data-function]'); let inventory = { wood: 0, stone: 0, dirt: 0 } itemBtns.forEach(e => { e.addEventListener('click', checkBtnFunc(e)); ...
Randomguy660's user avatar
0 votes
1 answer
31 views

Deduplicating nested values that are also key in outer dictionary - Python

Given an input dictionary, x = {'A fantastic gift for art lovers': ['Designed for adults, this stunning piece ' 'of 3D art can be proudly displayed on a ' ...
alvas's user avatar
  • 113k
0 votes
2 answers
65 views

Why will python function max() return different outputs if float('NaN') value is permuted in a dictionary but key-max_value remains the same?

Let's pretend I have the following simple dictionary: dictionary = {'a':3, 'b':4, 'c':float('NaN')} If I use function max() to return the key with maximum value... key_maxvalue = max(dictionary, key=...
NigelBlainey's user avatar
-2 votes
1 answer
37 views

Regex in sed command does not work properly

I have a yaml file like below. test: test_1: fact_1: Present fact_2: value_1 tag: tagvalue test_2: fact_1: NotPresent fact_2: null tag: null ...
Harini's user avatar
  • 65
3 votes
2 answers
95 views

Is there a good C++ key-value data structure where a value is mapped to a range of values?

I've been coding with C++ for a few years now and I've been working on a personal project of mine for a few months now. I'll spare you the details, but I've found myself in a situation where it would ...
Gengarboi's user avatar
0 votes
1 answer
30 views

How to retrive a values in the document as key in MongoDB Python

How can I retrieve a value in the MongoDB document as a Key in the result? I have the following sample document. [ {"student_id" : "ABC", "class_id" : 2, "sub&...
geethuth's user avatar
0 votes
2 answers
45 views

Check a subkey value using a random variable and a condition. KeyError: "x"

I'm having trouble with the dictionary code for checking the value of a subkey. I want to get that: If random_data is a word that matches "gender": "male" then I want to print &...
Evangelos Dellas's user avatar
0 votes
0 answers
26 views

How to return a value to enum not string in a dropdown button?

Here's the snippet for the dropdown items widgets: items: categoryList .map((item) => DropdownMenuItem<String>( value: item, child: Text( item, ...
jhonny's user avatar
  • 1
0 votes
1 answer
21 views

Swap values in second dictionary as keys in first dictionary - Python

I have tow dictionaries my_dict = {1 : 1.8 , 2 : 1.2 , 3 : 0.6} mapping_dict = {1 : "Number_1_fruit" , 2 : "Number_2_fruit" , 3 : "Number_3_fruit"} I want to first check ...
Fanelo's user avatar
  • 9
0 votes
1 answer
54 views

How can I add a tuple (key, value) from AVL Tree to a priority queue in java?

new java developer. I want to build a priority queue, where the elements are the nodes of my AVL tree. the priority queue should order the nodes with the one with the highest value first and the one ...
eshtabel3asal's user avatar
0 votes
1 answer
60 views

Trouble sorting a generic c# List (can have tuples, KeyValuePairs etc)

I'm trying create a method that will sort any kind of generic List. I'm starting with a double and have a construction already for other types, but even with a double I'm having issues as D below ...
ng80092b's user avatar
  • 615
0 votes
2 answers
47 views

Replace values in column based on key value pair

I have a data frame where the last column is used to label a plot. The column is mostly NAs, but has 12 values in it (matches the key in the list below). However, the label is wrong and needs ...
Melanie Baker's user avatar
1 vote
2 answers
47 views

Loop through a string-list and make key:pair in json format in Python

I have a csv file as: devid,1, devType,"type-928" devid,2, devType,"type-930" etc. Length of the lines might be different, depending on the number of key-pair values included. ...
Fakir's user avatar
  • 139
0 votes
1 answer
66 views

How to parse a value from a custom string-based key-value format?

Can someone hint me how to extract the NC value of the string-based custom key-value format which is the domainDetails related value of the below data-structure ... { notAfterTimeStamp: 123456787, ...
Divya's user avatar
  • 9
-1 votes
1 answer
30 views

My code works even though I didn't put the dictionary key / fieldnames in the CSV file

import csv phone = input("Enter phone name") os = input("Enter OS") with open("phos.csv", "a") as phos: phos_dict = csv.DictWriter(phos, fieldnames = [&...
ash-ash-noob-noob's user avatar
0 votes
1 answer
38 views

Uncaught TypeError when trying to access object values in JavaScript

I am trying to check if a word is not in my word list but keep getting this error: Uncaught TypeError: Cannot read properties of undefined (reading 'includes') at handleKeyup I have one file bigwords....
Poubom's user avatar
  • 1
0 votes
2 answers
21 views

Expand data to display chart

I have table like: let tbl = datatable (metric:string, ct:int, details:dynamic) [ "Some1",5, dynamic([ { "Key": "NO", "Value": 4 ...
lissajous's user avatar
  • 363
0 votes
1 answer
50 views

How to create a key:value pair or 2 sets of lists returning item ids and corresponding number of purchases in sql (or snowflake to be more specific)?

I have an enormous clickstream data which I can pull the timestamp, user_ids corresponding item_ids that customers clicked. I am trying to create a dataset that will have the unique customer ids (...
Salih K's user avatar
  • 31
0 votes
4 answers
97 views

Get Value from Key:Value Pair with variable as input and output

I have an array of Department Names and Department Codes in a script. A user will select a Department Name which is then assigned to a variable; I need to read the array (deptCodeArray) find the ...
BenPhilware's user avatar
0 votes
1 answer
140 views

ValueError: dictionary update sequence element #0 has length 1; 2 is required. Dataframe Python

I try to connect to a database and write data into a table from csv file. I have a such code and when I launch this code I receive this error: ValueError: dictionary update sequence element #0 has ...
Daryna's user avatar
  • 1
0 votes
0 answers
12 views

Can I limit the key-values ​of a Redux state?

Im gona super-minimalize the example: Typical Redux initialState: const initialState = { user: { city: 'newYork' } } Imagine the response to my api is something like this: user: { ...
ferter3006's user avatar

1
2 3 4 5
64