All Questions
Tagged with python-3.x function
3,604
questions
1
vote
0
answers
45
views
Cannot get this elif function logic to work for word-game solver, might need suggestions on better method overall
This is the latest functional attempt at doing entry validation for a Solver app (w/ a customtkinter GUI). It seems straight forward, and with a set defining the absolute values of what characters can ...
0
votes
2
answers
61
views
While loop won't end
I have a while loop that calls on three functions. The three functions work as intended and at the end it asks for a user input. If the user input is 'n' the loop is supposed to end, but it continues ...
0
votes
1
answer
70
views
"Preprocessing" a Python function, to avoid excess evaluation of conditional logic
I am writing some Python code that includes functions with two sets of parameters. The first set of parameters will be different every single time the function is called. The second set of parameters ...
1
vote
2
answers
65
views
How can I create a function in python that takes an object, modifies the location of it and other objects using CustomTkinter?
I am creating an app that lets you choose exercises and basically what I've been trying to do is create a function that takes the ".grid" element and for the exercise chosen and moves the ...
1
vote
3
answers
113
views
What does '[' after an argument in a call function signify in Python?
I have been going through the opencv wiki when I came across the resize function defined as:
dst = resize( src, dsize[, dst[, fx[, fy[, interpolation]]]] )
I am unable to understand what the [ after ...
2
votes
1
answer
88
views
How to remove specific parts of text from string?
I am using Python. I have a dataframe with string "description". In these strings, I have things like: "п. 5.6.2 ГОСТ 2.114-2016", "п. 4.1 ГОСТ 2.102-2013", "п.5 ...
0
votes
0
answers
14
views
Returning a subset of a nested dictionary - Returns None [duplicate]
I'm trying to create a function that take a nested dictionary and returns a subset/item depending on the path provided as an ordered tuple. I'm using a circular reference of the function to iterate ...
0
votes
1
answer
55
views
Python flask function isn't being called
So I'm new to flask and am trying to make a library website with flask and mongoDB but everytime I search for the books and try to click on the result for more information about the book it doesn't ...
2
votes
0
answers
31
views
Use a list ouput of a Python function as input of another function [duplicate]
I use the follwing Python code:
a, b, c = foo()
res = foo2(a, b, c)
I would like to write instead:
res = foo2(foo())
but it doesn't work: the output of foo is regarded as the first argument of foo2.
...
-2
votes
1
answer
45
views
When I tried to count the string of translated language (tamil) in Python, it didn't give me the correct count why?
code
I tried to count the string for the name 'KUMAR' with length function, output came 5 it is correct.
But when I tried to count the same name in a different language(Tamil) the output I expected ...
1
vote
1
answer
81
views
How to group rows in dataframe based on timestamps ranges and mean group size maximization?
I have a data frame:
prod_id timestamp1 timestamp2
1 2023-12-02 2023-12-01
2 2023-12-05 ...
2
votes
1
answer
47
views
How to group rows in dataset by two timestamps rage sizes?
I have a dataframe with two timestamps:
timestamp1 timestamp2
2022-02-18 2023-01-02
2022-02-19 2023-01-04
2022-02-21 2023-01-11
2022-03-11 ...
1
vote
1
answer
2k
views
Streamlit button on_click how to use it?
I've the following code
def drawBtn():
option= ...
st.button("Find", on_click= onSearch, args= [option])
def onSearch(opt):
# do something and then...
st.success("...
0
votes
2
answers
51
views
Run a class function with a string input [duplicate]
I am converting a program from one database (SQL Lite) to Mongo DB: so I have tons of functions that im trying to simplify.
How do I run a class function with the text input?
Example
def getListData(...
0
votes
1
answer
62
views
Creating a function to replace NaN value by traversing up hierarchy columns
I have 2 separate dataframes, data1 and df_attr.Where for df1, there is hierarchy data, where df1.manager_01_email is at the top of the hierarchy while df1.manager_04_email represents the lowest ...