i have 2 dataframes have same columns with different len. the reuslt i want to get: and each df have length like this. each dataframe has column named ‘name, id, type, len’ i need to check those columns(name,type,len) in each df to compare ‘id’ column whether it has same value or not. …
Tkinter Python – how to set a command for a column
I want to create a table like this: I want it to work such that when I click on “delete this record” it will delete that row of data. I am trying this code: Answer You can bind <ButtonRelease-1> on the treeview and then determine whether user has clicked on the required cells. If yes, ask fo…
Conditionally merge lines in text file
I’ve a text file full of common misspellings and their corrections. All misspellings, of the same intended word, should be on the same line. I do have this somewhat done, but not for all misspellings of the same word. misspellings_corpus.txt (snippet): Desired: template: wrong1, wrong2, wrongN->corre…
NoSuchElementException: Failed to find a default value for layers in MultiLayerPerceptronClassifier
I am having a problem running a prediction using a saved MultiLayerPerceptronClassifier model. It throws error: The original mlpc in the pipeline had layers defined: My attempts to solve it: If I run the pipeline model and do predictions without first saving the model. I works with no error. But saving and re…
Falcon server with SSL stops working after some hours/days
I set up a very basic Python API server with falcon along the example given in the documentation. And it seems to work just fine. Now I extended the code to support HTTPS requests using SSL certificates And again, it seems to work and HTTPS requests are served perfectly fine…in the beginning. However, a…
GNU Parallel and Python atexit
I was trying to run a python script with GNU parallel. Everything seems to work, except for the atexit routine used inside the python script. It seems, after ctrl+c, parallel is killing the python process without giving python a chance to call the registered atexit routine. How to make parallel a bit nicer to…
How do I merge values into one message in discord.py
I want my bot to be able to say a message, mention a user, then respond with a random message, all in the same line, as opposed to having it in 3 separate lines. This was my previous method: However, this makes them all appear in the same line, but I can’t figure out how to merge them into a
Is there any straightforward option of unpacking a dictionary?
If I do something like this I’ll get a list, but I want it in 2 dictionaries: first = {“a”: 1} and rest = {“b”: 2, “c”: 3}. As I understand, I can make a function, but I wonder if I can make it in one line, like in javascript with spread operator. Answer I don’t…
Filter based on pairs within a group – if value represent at BOTH ends
Within each group there are pairs. In Group 1 for example; the pairs are (2,2),(2,4),(4,1) I want to filter these pairs based on code numbers 2 AND 4 being present at BOTH ends(not either) In group 1 for example, only (2,4) will be kept while (2,2) and (4,1) will be filtered out. Excepted Output: Answer You c…
BeautifulSoup.select classname not working
I am trying to find tags by CSS class, using BeautifulSoup. Read documentation and tried different ways but the below code returns new_elem : []. Could you help me understand what I am doing wrong? Thanks. Answer As the url is dynamic,I use selenium with bs4 and getting the follwing output: Code: OUTPUT: