Questions tagged [pydash]

For questions regarding the pydash library. This is most likely also a python related question.

Pydash is a python library used as a utility with functionalities similar to lodash library in JavaScript.

Related Links: Project Documentation PyPi Github Actions

10 questions
116
votes
8 answers

ImportError: cannot import name 'escape' from 'jinja2'

I am getting the error ImportError: cannot import name 'escape' from 'jinja2' When trying to run code using the following…
Bheshaj
  • 1,262
  • 2
  • 3
  • 6
2
votes
1 answer

Python - PyDash example of reduce with accumulator

Looking for a code example using Python’s PyDash module of reduce with the accumulator arg, and how to output that with previous and current.
joe hoeller
  • 1,248
  • 12
  • 22
1
vote
1 answer

Pydash: how to find using a object: py_.collections.find(DATA, OBJECT)

In lodash I can use the syntax: find(ARRAY_OF_OBJECTS, OBJECT) This will return an object from the array if it meets the criteria of the passed object. In this case OBJECT would be e.g. { active: true, dimension: 'target' }. The objects in the array…
Edgar Koster
  • 479
  • 1
  • 5
  • 18
1
vote
1 answer

Python PyDash 'find' function returns Any instead of passed data type

The logic in my case is much more complex, but here is what it boils down to. I've got a list of dataclass instances. import pydash as pyd @dataclass class Info: color: str taste: str @dataclass class Fruit: id: int name: str …
tia
  • 13
  • 1
  • 4
1
vote
1 answer

extract aliases from wikidata dump using python

I am trying to extract certain fields about wikidata items from the wikidata dump, but I have a problem with the aliases field for a certain language, my code is based on the code in the following URL how_to_use_a_wikidata_dump, I made my…
Mai
  • 121
  • 1
  • 10
1
vote
0 answers

How to find a particular JSON value by key using List Comprehension and Pydash

I am trying to find a particular JSON value by key using List Comprehension and Pydash. I know there are multiple ways to do that , but I am more specific to get it done using List Comprehension and Pydash. I tried below code snippet, which is kind…
curiousguy
  • 3,212
  • 8
  • 39
  • 71
1
vote
3 answers

Reorganize a list of dictionaries

Assuming I have the following: [ {"sku": "ZZZ", "name":"None name","shelf": 10}, {"sku": "AAA", "name":"One name","shelf": 10}, {"sku": "BBB", "name":"The name", "shelf": None}, {"sku": "CCC", "name":"A name"} ] I am trying to find the best…
Ste
  • 283
  • 1
  • 15
0
votes
1 answer

How to map element of an array using pyDash in Python

I'm trying to chain and group than map an array using pydash The idea is to recreate the same output of this lodash function : let chainedResult = ( _.chain(oResult) // Group the elements of the result based on `CEMPLOYEE` property …
napi15
  • 2,354
  • 2
  • 31
  • 55
0
votes
1 answer

Set Inner values in python dictionaries without declaring multiple empty dictionaries

Lets say I have a dictionary like ship = {'AddNewShipmentV3': {'oShipData': {'ReadyDate': '2021-01-11T12:00:00', 'CloseTime': '2021-01-11T08:12:34', 'ServiceLevel': 'EC', 'ShipperName': 'Test 1/12/2021','SpecialInstructions': 'Invoice - RMA#S,…
ashakshan
  • 419
  • 1
  • 5
  • 17
0
votes
3 answers

find difference of values between 2 array of objects in python

I have 2 array of objects: a = [{'a': 1, 'b': 2}, {'c': 3, 'd': 4}, {'e': 5, 'f': 6}] b = [{'a': 1, 'b': 2}, {'g': 3, 'h': 4}, {'f': 6, 'e': 5}] Output: a - b = [{'c': 3, 'd': 4}] ("-" symbol is only for representation, showing difference. Not…
undefined
  • 3,464
  • 11
  • 48
  • 90