Category "python"

Serverless Python Local Module Not Found

I am looking to import my local python module file into my handler file in my serverless project, but despite this local file being located in the parent direct

Python dataclasses inheritance and default values

Given the following hierarchy of python dataclasses: @dataclass class A: a: str aa: str @dataclass class B(A): b: str @dataclass class C(A):

Dividing values in columns based on their previous marker

I have the following dataframe: df = {'id': [1,2,3,4], '1': ['Green', 'Green', 'Green', 'Green'], '2': ['34','67', 'Blue', '77'], '3': ['Blue', '45', '9

Python Flask_restplus flash_restx dynamic marshalling response

Is it possible to dynamicaly modify the marshalled response model (ie : change fields list, add mask, ...) ? ex : from flask_restplus import Resource, fields m

Python transform and filter list with for / if

Is there a way to both transform and filter in a single list comprehension, i.e.: def transform(el): if some_condition(el): return None return

How can I keep track of the information of multiple objects where there are various events in Simpy?

I tried to build a simulation model as below, but I got error. Here's my scenario. I have two big areas of hospital. EU (EU1 and EU2) IU (IU1 and IU2) Each bi

Python Selenium Chrome - Message: unknown error: cannot parse internal JSON template: Line: 1, column: 1, Unexpected token

This code works on two PCs but throws an error on another one. webdriver_path: str = os.environ.get("WEBDRIVER_PATH") chrome_user_data_dir: str = os.environ.get

How to specify a BaseSettings Config's env_file based on a field from the same class?

I want to implement this logic from pydantic import BaseSettings class Settings(BaseSettings): ENVIRONMENT: str = 'local' SECRET_KEY: str = 'someke

getting Fatal error in launcher: Unable to create process using '"c:\python37\python.exe" "C:\Python37\Scripts\pyrcc5.exe"

So i'm a beginner at machine learning and i want to try out this project i found it youtube (link here) but the problem is when i get onto the step where i do p

Django 404 error-page not found, how can I solve this problem?

My project is named main, and when I runserver I get this error.Anybody have any clue how to fix this error. Page not found (404) Request Method: GET Request UR

Discord Python bot - Coroutine never awaited

I'm trying to make a Blind-test bot game in Python, which actually works pretty fine. I managed to get a whole spotify playlist in the queue with that play_next

Python Zybooks lab function definition input

I have a zybooks lab with the prompt: Write a function max_magnitude() with two integer input parameters that returns the largest magnitude value. Use the funct

Map range from 2 columns based on overlapping range in another Pandas dataframe and sum values for same range

I have two datasets (df1 and df2) of values with a certain range (Start and End) in both of them. I would like to annotate the first one (df1) with values from

loading tensorflow dataset gives NonMatchingChecksumError

My goal is to use the following dataset from tensorflow-datasets for Machine Learning https://www.tensorflow.org/datasets/catalog/wider_face import tensorflow a

how do i press enter on a cr-button with selenium python

# import the webdriver from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys import time im

TypeError: 'module' object is not callable (+static(settings.MEDIA_URL,document_root=settings.MEDIA_ROOT))

here is my django project's urls.py from django.urls import path from .import views from django.conf import settings from django.conf.urls import static urlpa

Read timeout in pd.read_parquet from S3, and understanding configs

I'm trying to simplify access to datasets in various file formats (csv, pickle, feather, partitioned parquet, ...) stored as S3 objects. Since some users I supp

Getting error while generating heatmap in python:ValueError: Must pass 2-d input. shape=()

I am getting errors while generating maps of h3 moments in python for an image file called "image_test". The error apparently is for the shape of the values tha

How to use data files of sub-directories and perform iterative operation in python

I have my jupyter notebook (python script) in current directory. In current directory, I have two subfolders, namely a and b. In both directories a and b I have

await vs asyncio.sleep: Does await keyword return control to the loop? Or maybe Pythons's asyncio StreamReader.read() is blocking?

I encountered a strange situation. StreamReader in asyncio seems to be blocking. received = asyncio.Queue() async def read_loop(): while True: rece