Category "python"

Making a tree form a Dictionary of lists

I'm a new programmer. I am trying to make a Tree from a dictionary that contains all the links between the nodes. Here is an example { 'A': ['B', 'C'], 'B': ['A

PyTorch bool value of tensor with more than one value is ambiguous

I am trying to train a neural network with PyTorch, but I get the error in the title. I followed this tutorial, and I just applied some small changes to meet my

Read Files across File Systems (PyCharm Windows/WSL)

I'm using PyCharm with a WSL interpreter because I need to use a library that doesn't work well with Windows (gtsam, if you're wondering). I have a pandas Dataf

How can I extract and store the text generated from an automatic speech recognition deep learning app

The app can be viewed in huggingface https://huggingface.co/spaces/rowel/asr import gradio as gr from transformers import pipeline model = pipeline(task="auto

Mean, Var, and Std

The Task is You are given a 2-D array of size X. Your task is to find: The mean along axis The var along axis The std along axis Input Format The first line con

Airflow - What do I do when I have a variable amount of Work that needs to be handled by a DAG?

I have a sensor task that listens to files being created in S3. After a poke I may have 3 files, after another poke I might have another 5 files. I want to crea

Python Plotly How to remove datetime gaps in candle stick chart?

I am trying to remove the datetime gaps in my candlestick (the gaps are the time periods when the stock market is closed, hence there are not data). Can't seem

MyPy configuration - exclude multiple directories

We're currently using Mypy (v 0.910) in our project with pyproject.toml for configuration. I have the following file structure: src --app --generated

cv2 polylines can't draw on numpy array "Expected Ptr<cv::UMat> for argument 'img'"

I'm converting a pytorch tensor representation of an image and series of points to numpy so that I can draw lines between the points and display the image in ju

How to run FastAPI app on multiple ports?

I have a FastAPI application that I am running on port 30000 using Uvicorn programmatically. Now I want to run the same application on port 8443 too. The same a

Why doesn't the Python socket receive packets?

My program doesn't receive any packets (on UDP, Windows 10), but when I sniff the data on Wireshark I can see that the data is indeed sent. I know that it doesn

create dataframe from dictionary of datetime and int

I have datetime and int values dictionary like below. end_date = datetime.datetime.strptime("01-12-2020", "%d-%m-%Y") details = { datetime.datetime.strptime

Pyqt5 Start-Stop Button

I want to make a simple start/stop button. But I couldn't get the stop button to work. Can you help me with this? def pressed(self): self.infoL

Error when converting xml files to tfrecord files

I am following the TensorFlow 2 Object Detection API Tutorial on a Macbook Here's what I got when running the given script for converting xmls to TFrecords Trac

The most common letter in a string (Python)

I have an exercise to find the most common letter in a string, excluding punctuation symbols, digits and whitespaces and the result should be in lowercase "A"==

How to make a standalone installer for Python project which includes Python installation

I have a Python project which has following directories and files: PythonProject -> configs -> appconfig.json -> logs -> app

Signal correlation shift and lag correct only if arrays subtracted by mean

If I have two arrays that are identical except for a shift: import numpy as np from scipy import signal x = [4,4,4,4,6,8,10,8,6,4,4,4,4,4,4,4,4,4,4,4,4,4,4] y =

Label Studio Time Series

i'm working with Label Studio to label some time series data. I'm struggling to follow the documentation and i'd like to add some configurability, i'm unsure if

Sphinx - Specific file documentation with autosummary

I'm trying to use Sphinx's autosummary extension to generate the documentation automatically for the methods of a single file. I have the following folder struc

How can I install my own Python package in Azure Web App Service Linux environment?

I deployed my Python Django project to Azure Web Service Linux environment, and found an error most likely caused by the version of Azure's own Python version (