Category "python"

How to concatenate the values of a dataframe along column axis and fill missing values?

I really stuck in this problem for a long time. I have a data frame, I want to group the data based on the ids and then stick the values for each id together. H

<B1-Motion> binding is unresponsive in Tkinter

I've been working on learning more about the Canvas() widget in tkinter, so I decided to build a simple paint app just for practice. To achieve this, I created

Find the nth character of an increasing sequence

Recently i saw a competitive coding question, the bruteforce approach doesn't meet the time complexity, Is there any other solution for this, Question: An expan

Keras model `logits` and `labels` must have same shape (None, 2) vs (None, 1)

I have a keras model trained for occupancy detection of parking spaces, which I load using keras.models.load_model(PATH_TO_MODEL). The input for the model is a

tkinter, or function to pass filename into variable for use in other function

My code below is to be used in a GUI that has two buttons. One to ask the user to locate a txt file, the other to run a function using that file to clean the da

Error extracting heads from MODFLOW-USG binary with flopy

I'm trying to extract the simulated heads from a MODFLOW-USG binary head-save file, so I'm using flopy as follows: modelname = 'Model' import flopy.utils.binar

Google crash curse optional question solution about For loop

I decided to pass google curse for python beginners and stuck on this question. It is optional to solve but I'm angry about it as I understand that it is simple

how to get json object out of django paginator value

am trying to get a Json value out of Django Paginator object so that i can return it back to html file as a json response via JsonResponse method.Please help He

How to reread uncommitted messages until they are committed?

Let's say we are using Kafka with manual commits. We are processing the incoming message. But if there is a failure in processing for any reason, we want to rer

NRRD File of brain tumor is not being read into python with pynrrd module

I have nrrd files of the brain tumor. When reading the file into an array with a header and passing the code print(filename), I get an array of zeros. I checked

Json problems in (AWS lambda, formatting and line by line)

The idea: I want to send some json tweets (from file) to AWS kinesis, S3, lambda, AWS comprehend then S3 again. The sample tweets: [ { "tweet_id": 56758

OpenCV HoughCircles parameters for detecting circles (microstructure spheres)

I am creating program that helps processing microstructure images. One of the function is detecting circles with the same radius. User draws one circle, my prog

Cognito throwing Username should be an email

I am attempting to build a lambda function connected to an API gateway POST method that will allow users to create and register cognito users within a given poo

Django rest framework jwt {"detail": "You do not have permission to perform this action."}

I am trying to make a request using django-rest-framework and django-rest-framework-jwt but The response that I get detail": "You do not have permission to perf

The view function for 'run' did not return a valid response. The function either returned None or ended without a return statement

I did write an HTTP Cloud Function in the Google Cloud Platform. The purpose of this function is to update data in the Database (Firestore). I do not intend to

How to create arrays with combinations between certain indexes of a fixed length and fixed sum

For example: array = [4,3,2,0,0,0,0,0,0] The 0th index should only have combinations with 3rd index and 6th index. The 1st index should only have combinations

Converting non-conventional CSV into a compatible CSV

I got this kind of CSV which is not an CSV. Let me explain it. The output has column_name,value. e.g. created_at,2022-02-10T16:53:49+01:00 upd

What is the best way to generate all possible three letter strings?

I am generating all possible three letters keywords e.g. aaa, aab, aac.... zzy, zzz below is my code: alphabets = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',

Always tkinter Text highlight_patern not working [closed]

I've used this question but can't seem to do it again later. I call it with root.after later but then it does nothing. my code is: class Custo

Handwriting detection with keras : using a `tf.Tensor` as a Python `bool` is not allowed in Graph execution

I've tried to run a code example (hosted on keras.io) regarding the handwriting recognition task. While playing with the code, I faced a TensorFlow-related issu