I need to find ‘user_id’ of users standing closeby to each other. So we have data: So, in this dataset it would be users with id ‘101’ and ‘302’. But our dataset has millions of lines in it. Are there any built-in functions in pandas or python to solve the issue? Answer Ass…
Tag: python
Ηow to select a dataframe index via a dropdown menu in Flask?
Context and what I want to do : Hi, here is an example with the iris dataset. I have imported my machine learning model, and my web-app idea is : that instead of entering floating values of features in fields myself to run an iris class estimation, I want to use instead the index of the dataframe in a dropdow…
stacking LSTM layer on top of BERT encoder in Keras
I have been trying to stack a single LSTM layer on top of Bert embeddings, but whilst my model starts to train it fails on the last batch and throws the following error message: This is how I build the model and I honestly cannot figure out what is going wrong here: this is the full output: The code runs
Images Have Grey Values of True and False
I’m planning to process some images using PyCharm. However, I find a bug and start to find the reason. Finally, I find that the images have grey values of True and False, but they should be 1 and 0, is there any way to change it? The image is generated in PyCharm using: The Python version is 3.8.12. Ans…
Make dummy variable for categorical data, based on ID column with duplicate values in python
I have the following pandas dataframe: I want to make dummy variables for the values in the column ‘value’, for each value in the column ‘ID’. So I want it this: How can I do this in python? Answer Use crosstab with limit counts to 1 by DataFrame.clip:
Make a data profiler class that takes as params on the init a list of data
I need this class to include the following methods only using self: get_summary_stats: should calculate the mean, min and max. min_max_scale: converts the array to 0-1 values. score_scale: converts the array to zscores. I’m trying it this way without luck, when you run it it smoothly goes by but when I …
How to Create a Tamil Phonetic keyboard inputs in python?
My target: create a Phonetic Keyboard in the Tamil language, using dictionary key mapping. My struggle: How to replace my keys with values and set that value to my textbox. For Example: If I press “K” in textbox1, then my textbox1.text will change into the Tamil letter “க்”, if I press…
How to take results of GROUPBY and expand to columns
Here’s an example of my working code that accomplishes what I want but is much too long. The resulting data frame is in the format I want here: I know that I can accomplish close to what I want with a groupby() on the ‘Specialty Type’ and the ‘Foundation Threshold’ using an .nuni…
why is my speech recognition not working in python
I am working on this project and its simply a desktop Assistant I am using speech recognition and pyttsx3 but the speech recognition is not working after the try nothing is executing it just jumps to except and passes can someone tell me why? and how I can fix it edit: I tried to install pyaudio but it won…
Printing sales order doesnt work with exact online
I am trying to print a sales order with a known OrderId however it throws an error which I haven’t been able to debug. error is: What is the problem here? Please help Answer It turns out you need to use the json argument instead of using data. This becomes Content-Type header can be set as application/j…