All Questions
26 questions
3
votes
1
answer
228
views
Finger Exercise: Update book cipher by creating new book
I'm working my way through the finger exercises in John Guttag's book Introduction to Python Programming, third edition. The following finger exercise on page 143 describes encryption/decryption with ...
0
votes
1
answer
40
views
Is using except TypeError the right way to do this? [closed]
I have some code that uses a lambda to enhance the functionality. For backward compatibility reasons, this lambda can take one or two arguments. To handle these ...
7
votes
2
answers
578
views
A Hit Counter For AWS Python Lambda powered with DynamoDB
I'm learning how to use DynamoDB and various AWS services, so I decided to write a simple hit counter application for my education of how to use DynamoDB. This application deduplicates hits from the ...
3
votes
1
answer
380
views
Delete older EBS Volume snapshots except few with certain tags using Python, Lambda
I am learning Python and managed to accomplish the above. But my script doesn't seem optimal. Could someone help to take a review and suggest for betterment?
...
0
votes
1
answer
2k
views
Is this the right way to do lambda method chaining in python? [closed]
I come from java background and I am trying to implement lambda chaining in Python. Below is my code
...
3
votes
2
answers
1k
views
Create dummy variables in dataframe using for loop and apply lambda
I like to compute dummy variables based on the existing values in a dataframe and a dictionary with certain "cut off" points. I wonder whether I need to get rid of the for loop in the ...
5
votes
2
answers
4k
views
Python: Function to Find 2 Closest Points Among [x,y] Coordinates
I'm writing some code in Python that takes a set of [x,y] coordinates (in a list of tuples) and also an x-value. I need to find the two closest x coordinates to my x-value.
To find the closest x, I ...
1
vote
1
answer
4k
views
On tkinter: scrolling multiple widgets simultaneously in different frames
Below is an example on how to scroll two canvasses in two separate frames simultaneously. The trick is on how to pass on *args from the bindings to function ...
4
votes
2
answers
144
views
Extension on Python Lambda capability
I asked for assistance creating a Python Lambda function capable of assignments and multi-line lambdas in this post. Following @l0b0's suggestions, I realized that it was better constructed as a ...
5
votes
1
answer
99
views
A less limited Python Lambda
I've often wanted an anonymous function that would do more than return the result of an expression. So I developed one around the exec function that supports assignments and multiline lambdas but ...
2
votes
0
answers
181
views
Handling IndexError using lambda function within scrapy
I've written a script using python's scrapy library to parse some fields from craigslist. The spider I've created here is way normal than what usually gets considered ideal to be reviewed. However, I'...
3
votes
3
answers
489
views
3
votes
1
answer
3k
views
Select value based on condition on dataframe
I have some data in data frame and would like to return a value based on specific conditions. It is highly time consuming.
I tried three methods:
Method 1:
Without dataframe, this is the simple ...
3
votes
2
answers
276
views
Plotting a 2D iso-probability curve
I have a library function that returns a pair of two numbers like this
def library_function(x0, x1):
return x0**2 + x1**2, 10*x0*x1 + 1
(Actually, it is a ...
4
votes
2
answers
114
views
What is the best way to extract method?
The code snippet is what I want to do. Previously I use a different version of my code. But it is out of joint according to Python coding guidelines because I was assigned my lambda function to a ...