Category "python"

Lookup table in TensorFlow with key is string and value is list of strings

I would like to generate a Lookup table in TensorFlow with key is string and value is list of strings. But it seems currently no classes in tf.lookup support th

How does "template.Library()" and "get_related_name" work in django?

I'm working on a basic social media django project with the help of an udemy course. The following are the models i created: group : models.py register

In Simpy simulation, how can I escape from infinite loop

I have an endless loop problem in Simpy simulation. My scenario is: After finishing triage, a patient wait until getting empty bed. However, if there is no empt

List changed in a function [duplicate]

I'm supposed to rotate the list iteratively which means put the first element to the last, and the rest move forward until it back to the orig

Using a Python dictionary to simulate switch statement with default case

Is there a valid Python syntax for the following idea: d = {_: 'value for any other key', 'x': 'value only for x key'} value = d[key] which should assign 'valu

How to make python ELK APM log correlation works

I am using python with ecs_logg https://www.elastic.co/guide/en/ecs-logging/python/current/installation.html. It output to a file. Then I am having a logstash r

How can I trace why a variable is not populated at init time in Kivy GUI?

How is it possible that the Kivy GUI app is not load the whole code at the time of initialization? Is it possible that when we called some function so the execu

How to check mysql table with python

I want to create a license system for my codes in python. Now I am facing an issue: how can I check if an integer is contained in my MySQL database? Here are so

How can I switch pages inside QStackedWidget every 15s without clicking any buttons using python

I made a Layout in QT Designer, I have a QStackedWidget with 2 pages and I would like to know how I can move from page inside the QStackedWidget every 15s witho

does filtering queryset in django query database every time?

Imagine I have the following code: qs = Users.objects.all() list = [] for i in range(10): list.append(qs.filter(age=i)) here the filter is called 10 times

Matterport's mask rcnn doesn't train after setting up parameters

Task: Mask RCNN train_shapes.ipynb tutorial. Training to segment different shapes in the artificially generated shapes dataset. Problem: Matterport's Mask RCNN

How do I compose different objects from a package/framework into a class or object the pythonic way?

Lets say I a have two objects of different framework that I cant alter (one is C implemented and the other uses a nested factory to instantiate): # framework_a.

Why do I get [INFO] Worker Exiting (pid: 2) when deploying cloud run service with docker? (On VSCode with cloud code extension)

I'm really new to this stuff, I'm a 16 year old currently doing a research project/internship, and I've just started 2 weeks ago. So I'm extremely confused. I'v

Configuring PostgreSQL schema for default Django DB working with PgBouncer connection pool

I need to set the default DB schema for a Django project, so that all tables of all apps (including 3rd party apps) store their tables in the configured Postgre

How to import two different things called the same from different modules?

I have two modules, first one is PIL, and the second one is wand, which I import from PIL and wand something called Image, and there is conflict, how do I overc

Add custom NER to Spacy 3 pipeline

I am trying to build a custom Spacy pipeline based off the en_core_web_sm pipeline. From what I can tell the ner has been added correctly as it is displayed in

Beginners Coding Error, While Loop Triggering 2 Messages

I am a beginner that just started learning python this Monday and one of the first hurdles I am getting into is while loops. I was trying to code a number guess

Convert dictionary of lists to dictionary of dictionary

Current output is of format, dictionary of lists { "majestic-service-1.324.02070909": [ "/home/robotics/arm-services/FeaturesDir.yaml", "/ho

random number generating function as argument in python

I want to pass a function which generates random normal numbers to another function, do some calculations and pass again the random function x times. At the end

How to connect and query MySQL DB from python shell job in AWS Glue

I was using sqlalchemy to create connection and query mySQL DB, however, glue doesn't seem to support "sqlalchemy" or even "pymysql". Is there a way to do this