Category "python"

Heroku H10 error when deploying Flask application with Psycopg2

Runs locally, but not when deployed to Heroku (see error message). I tried adding a runtime.txt file with the Python version, and tried most of suggestions to s

How to connect kafka IO from apache beam to a cluster in confluent cloud

I´ve made a simple pipeline in Python to read from kafka, the thing is that the kafka cluster is on confluent cloud and I am having some trouble conecting

Deploying a Django application to Heroku - No module named 'django_project.wsgi

I'm trying to deploy a django application but I keep getting this error: ModuleNotFoundError: No module named 'django_project.wsgi' In fact, here's the full lo

Correction of time series data with conditional statements?

I need to correct a time series data which has jumps in between. Please look at the attached trajectory plot. The trajectory is around 550 (y-axis) and then sud

Deeplabv3 validation loss is nan

I had around 360 images splitted %25 as validation data. I could train Deeplabv3 with those images without any issue. Later on I have added around 40 images wi

I this the correct way of computing the average accuracy?

I am fairly new to coding and getting confused between average accuracy and overall accuracy. I have created a function to calculate accuracy, i then divide thi

Python Remap function returns not an image

I have a problem with the code. There is no compile error, but the result does not give a corrected image. Could someone please explain me where is my error. I

list' object has no attribute 'to' in trainer function in torch to(self.device)

class Trainer: def __init__(self, modelName,model,train_partial_dataset, val_dataset, loss_function, optimizer,path_save_best_model,device):

Get certain number of elements from Itertools.combinations

I need to split the total number of elements in iterator : tot= itertools.combinations(dict1.keys(), 2) into 3 parts. The size of dict1 = 285056 Total combinati

RuntimeError: Found dtype Long but expected Float when fine-tuning using Trainer API

I'm trying to fine-tune BERT model for sentiment analysis (classifying text as positive/negative) with Huggingface Trainer API. My dataset has two columns, Text

I need to make a random selection of two arguments with a percentage

I need to make a random selection of two arguments with a percentage For example, variable a(like) has a 82.5% chance of falling out, and variable b(dislike) ha

fiona ImportError: ... Library not loaded: @rpath/libpoppler.91.dylib

I reinstalled Anaconda (Anaconda 3, Python 3.9) on my Mac (MacOs Monterey 12.2) today. I installed geopandas through conda-forge and imported it successfully in

How can I read a c3d file on Python?

I'm trying to read a c3d file on Python with the btk library but I didn't succeed. I downloaded the library here https://code.google.com/archive/p/b-tk/download

Reversing row values in a panda

i'm having a mind wipe, i cannot for the life of me figure out a simple way of reversing this input to the output, any help would be appreciated. input: level1

python and BaseHTTPRequestHandler : add an empty favicon in the header of the generated page

On python 3.8, I created a minimalist python server for my students with BaseHTTPRequestHandler and HTTPServer from the module http.server When I go to the url

Use hardware Trigger in Baumer neoAPI python SDK

I want to use Hardware Trigger in Baumer camera with neoAPI SDK. I found continuous mode in example but no documentation available for hardware trigger. import

The Sum of Consecutive Numbers in Python

What I have to do is get the user input and add consecutive numbers starting with one using a loop until the sum equals or exceeds the input. It's an exercise,

Creating new pandas columns from substrings in a list

I have data in a csv called 'Features' which is of this form: 0 [Shops: Close by, Passing trade: Yes] 1 [Lift: Yes, No of Bedrooms: 1, Bedroom 1 Dims:

How to convert a Markdown table from horizontal display to vertical in Python?

My code is this: from tomark import Tomark dict = [{ "key":"value", "key":"value", "key":"value"}] markdown = Tomark.table(dict) print(markdown) The result is

Add security checks in graphene resolver

I am using Django and Graphene to serve a graphql endpoint and I have hit a bit of a problem I can't seem to figure out. I have following resolver: class Query(