Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
0 votes
0 answers
19 views

Read Large JSON File and Flatten Lambda

I have a lambda function that reads in a json file and flattens it so that I can convert it to parquet and it'll be easier to read the data. The issue I'm having is that some of the files are too ...
nahmed's user avatar
  • 67
0 votes
0 answers
14 views

AWS Lambda python log file is not created

I have a Python AWS lambda with a logger that generates two different log files: LOG = f"/tmp/{uuid.uuid1()}_log.log" SLOW_LOG = f"/tmp/{uuid.uuid1()}_slow.log" logging....
PloniStacker's user avatar
-5 votes
0 answers
63 views

I am trying to understand lambda.... why can I not print a list directly when it has been populated by lambda? [closed]

The following is the code I found in a learning website. callables = [] for i in (1, 2, 3): callables.append(lambda a=i: a) for f in callables: print(f()) Why can we not print the callables ...
Sujitha A's user avatar
0 votes
2 answers
47 views

Transformations on Multiple Columns in Pandas Dataframe

Using the pandas framework in Python, I need to apply a transformation on 4 columns (Col1, Col2, Col3, Col4 in example Code) in a table. The Transformation is quite simple: Extract a Unix Timestamp ...
Wesley Jeftha's user avatar
0 votes
2 answers
76 views

What does "lambda x: x-0 and x-1" mean? [duplicate]

What does the expression do? my_tuple = (0, 1, 2, 3, 4, 5) foo = list(filter(lambda x: x-0 and x-1, my_tuple)) print(foo) What output is to be expected from above equation?
user26230692's user avatar
0 votes
0 answers
31 views

How can I sort a dictionary with in the dictionary by the keys of the second dictionary in python? [duplicate]

I have a dictionary as follows: dict_1 ={'Spain':{'wins':1,'loses':0,'draws':2,'goal_difference':2, 'points':3},'Portugal':{'wins':3,'loses:1,'draws':1,'goal_difference':0,'points':4},'Morocco':{'wins'...
MohammadMahdi Saeedi's user avatar
0 votes
1 answer
48 views

Why does Lambda work differently in VSCode and Jupyter Notebook? (python3)

Why doesn't python Lambda work in VSCode? How is VSCode different from Jupyter Notebook? from Effective Computation in Physics book there is this Lambda example: (lambda x, y=10: 2*x + y)(42) ...
Isaac Mrowka's user avatar
0 votes
0 answers
14 views

Attempting to use locally cloned version of Python package in Docker throws metadata error

I am testing an experimental library version and must run it in a docker container locally rather than as a pip install. As a result, I copy all of the files from the locally cloned library into the ...
M. Nicol's user avatar
  • 113
2 votes
1 answer
36 views

Python Split and assign into new Columns

I have been worked in a dataframe with one column which has data for different calls to APIs. I need to split by "," and add new columns depends of the method's name (each API contains ...
Bruno's user avatar
  • 25
0 votes
1 answer
80 views

Use of lambda to perform basic multiplication

I am trying to do basic multiplication within all the individual elements of this list, but where am I going wrong with using lambda expression here? inputData = [[2, 3], ["4", 7], [6, 4], [...
TotalGadha's user avatar
0 votes
1 answer
55 views

'Mul' object is not callable when iterating a function

I have this code, I am trying to get the fixed points from a function in each iteration from 1 to n: import sympy as sp def logistica(): return lambda r,x : r * x * (1 - x) def ...
César Lozano's user avatar
1 vote
1 answer
37 views

sorting a list of tuples using lambda, python [duplicate]

I have a list of tuples that contains (name, score). I want to sort the list on the second element (reverse = True) and if two names are similar then sort it on first element but not using reverse. I ...
parsabr's user avatar
  • 11
1 vote
1 answer
31 views

Analyse historical data: average of every hour of every day over a number of years

I have historical data from 2012 to 2023. I am trying to calculate the average for every hour in every day over these years to build a 'reference year' or 'baseline'. My DataFrame (final_df) looks ...
snkm's user avatar
  • 27
0 votes
1 answer
53 views

Iteratively source a value from a dictionary

I have a data set where I know a limited number of values and based on other values in a data set I can figure out what the subsequent values are. I could do this with a huge if function, but I know ...
James Oliver's user avatar
1 vote
1 answer
46 views

Python pandas dataframe using apply to call function with list output

I am trying to apply a function to each element of a column of a pandas data frame. This function should return a list of strings. I would like to have each string in the list become its own column. ...
JWood's user avatar
  • 37

15 30 50 per page
1
2 3 4 5
330