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

All Questions

Tagged with
1 vote
1 answer
55 views

How to call a function from a function in a class that is called using a button with a lambda in Python3x?

I have a class: MyClassName for example, with two functions: one to calculate a number and one to validate if a group of comboboxes (tkinter) all have selections. I'm also using tkinter for a button ...
James-Jesse Drinkard'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
0 votes
1 answer
34 views

TypeError: finance_tracker.create_widgets.<locals>.<lambda>() missing 1 required positional argument: 'col'

I am getting an error in the following code class finance_tracker: def __init__(self, root): self.root = root self.root.geometry("1000x550") self.root.resizable(...
Geethaka Sankalpa's user avatar
-1 votes
1 answer
28 views

pd dataframe applymap tries to modify col names

Hello i have a dataframe containing datetime infos and i'd like too format those infos so i've used this command : df2[["month", "day", "hour", "min", "s&...
FrozzenFinger's user avatar
1 vote
1 answer
51 views

Partition by column, order by another

I am simulating a SQL query with the following values: rows = [(1, '2021/04', 'Shop 2', 341227.53), (2, '2021/05', 'Shop 2', 315447.24), (3, '2021/06', 'Shop 1', 1845662.35), (4, '2021/04', 'Shop 2', ...
David542's user avatar
  • 109k
0 votes
0 answers
31 views

Flask endpoint to Lambda function

I have a bunch of endpoints in a utility Flask application. One endpoint is like this: @app.route('/Terminal/Velocity', methods=["GET"]) def terminal(): if request.method != "GET&...
user2399453's user avatar
  • 3,041
0 votes
0 answers
74 views

b'./bin/freshclam: error while loading shared libraries: libltdl.so.7: cannot open shared object file: No such file or directory\n'

Lmabda antivirus-update error. b'./bin/freshclam: error while loading shared libraries: libltdl.so.7: cannot open shared object file: No such file or directory\n' In the Dockerfile, the command &...
shuji.takeda's user avatar
2 votes
1 answer
94 views

Why does using *kwargs.values() within a lambda function's parameter list result in a SyntaxError?

(lambda **kwargs: *kwargs.values())(a=1, b=2) This code snippet raises a SyntaxError, specifically stating "invalid syntax" pointing to the use of the * operator within the parameter list ...
Zimzozaur's user avatar
0 votes
0 answers
22 views

lambda function in key argument in sorted() method in python? [duplicate]

I found this code from online and tries to find what is the logic.But i didn't get it. from collections import Counter arr = [4,3,1,1,3,3,2] k = 3 c = Counter(arr) print(c) s = sorted(arr,key = lambda ...
abilaashrajesh's user avatar
1 vote
1 answer
52 views

How to replace the outlier with 3 standard deviation value for all column based on group by column?

Hi I have data frame in which I want to replace/cap the outlier with the 3*standard deviation value for all column with group by for each column. For example: df = pd.DataFrame({"A":["A&...
ASD's user avatar
  • 47
1 vote
2 answers
84 views

Simple lambda expressions in python but occurs error 'maximum recursion depth exceeded in comparison'

This is my code. def div_by_primes_under(n): checker = lambda x: False i = 2 while i <= n: if not checker(i): # checker = (lambda f, i: lambda x: x % i == 0 or f(x))(...
Asatsuki Mio's user avatar
2 votes
1 answer
39 views

Mapping strip() to strings in pandas dataframe does not change NaN entries but still claims that they are different?

I have a dataframe where I have very different kinds of entries (text, integers, floats, times, etc.) and I am trying to delete leading and trailing whitespaces from text entries so that my other code ...
python3 programmer's user avatar
0 votes
0 answers
42 views

List comprehension of lambdas generates identical functions [duplicate]

I want a list of functions where the ith function takes a vector as input and returns the ith element of that vector n_functions = 10 func_list = [lambda z: z[i], for i in range(n_functions)] However ...
Physics_Student's user avatar
1 vote
1 answer
216 views

Adding leading zeros to zipcodes that are less than 5 digits in pandas dataframe

I have a pandas dataframe that has a column of zipcodes and I want to add leading zeros to the zipcodes so they all have five digits. This is the code I use which correctly identifies the values that ...
pyphan's user avatar
  • 15
-2 votes
5 answers
270 views

Python Nested lambda function

Would there be a way to write a nested lambda function? The following is what I am trying to do: s = '123 there' f = lambda x: x.split() g = lambda x: [int(x[0]), x[1]] #g(f(s)) returns [123, 'there']...
James C's user avatar
  • 210

15 30 50 per page
1
2 3 4 5
54