Quantcast
Channel: Active questions tagged python - Stack Overflow
Browsing all 13861 articles
Browse latest View live

How to calculate the average value of adjection rows?

I have a text file like below:apple_1 1 1 2apple_2 2 3 4apple_3 3 5 6book_1 1 4 5cook_1 2 4 3cook_2 4 6 9book_1 2 3 4..The numbers in each row, except for the first column, are random.What I need is...

View Article


Redshift + SQLAlchemy long query hangs

I'm doing something among the lines of:conn_string = "postgresql+pg8000://%s:%s@%s:%d/%s" % (db_user, db_pass, host, port, schema)conn =...

View Article


How to mock pydantic BaseModel that expects a Response object?

I'm writing tests for my API client. I need to mock the get function so that it won't make any requests. So instead of returning a Response object I want to return a MagicMock. But then pydantic raises...

View Article

Install ursina on Windows11

the code on terminal:pip3 install ursinadin't work.can somebody help me installing ursina on windows 11.i also tried :pip install ursinaand it also didn't work.PS: i knewpip3 -m install ursinadoes not...

View Article

Vectorize nestled loops for pairwise distance calculation

How to make the script below more efficient? This is a follow-up to my previous post Python nested loop issueIt currently takes the best part of two hours to process input tables consisting in about...

View Article


Selenium Chrone WebDriver object hangs in Docker on creation

Trying to initialize a Chrone WebDriver object inside a Docker container and then perform a get() method with a URL.I have access to the web from docker (can ping www.google.com) and selenium is of...

View Article

Buildozer converting apk fail

When i try kivy to apk in github actions or google colab or ubuntu virtual machine it give this error# Command failed: ('/usr/bin/python3', '-m', 'pythonforandroid.toolchain', 'create',...

View Article

autotrain.trainers.common:wrapper:92 - No GPU found. A GPU is needed for...

❌ ERROR | 2024-02-06 11:07:29 | autotrain.trainers.common:wrapper:91 - train has failed due to an exception: Traceback (most recent call last):File "/app/src/autotrain/trainers/common.py", line 88, in...

View Article


Fillenotfounderror while not writing or opening a file

Good day,I'm having a problem i can't really explain. The error i get is "filenofounderror" to my understanding of python. you can get this error while using open() and when using relative path to a...

View Article


ev3dev - usage of ultrasonic sensor with python

i'm fairly new to programming and robotics and struggling with the following. i'm using the Lego Mindstorms EV3 brick and setup the ev3dev2 environment. i would like to program the robot in the way,...

View Article

Image may be NSFW.
Clik here to view.

LangChain + Hugging Face -> LangChain LLM import error

I'm trying to do the following simple code:from transformers import pipelineimport langchainfrom langchain.llms import HuggingFacePipelinemodel_name = "bert-base-uncased"task = "question-answering"I...

View Article

OpenAI gym error -> AttributeError: 'dict' object has no attribute 'all'

import osimport tensorflow as tfimport gymimport numpy as npimport matplotlib.pyplot as pltfrom gym import envsprint(envs.registry.all())# TODO: Load an environmentenv = gym.make("MsPacman-ram-v0")#...

View Article

Anyone worked on computer vision for virtual try on...? [closed]

I had this idea for a virtual try-on, I don't have any experience with computer vision or how to start this project.If anyone has worked on the same or has an Idea about please help me.Thanks and...

View Article


Jsonschema validate if the list contains one of the three strings

I have a json like this: {"mylist": ["a", "b", "c", "d", last_element]}Here, last_element could be one of the following four strings - "w", "x", "y", "z"; but not multiple.Examples:{"mylist": ["a",...

View Article

Could not Convert String to Float w/ADNI classifier

import pandas as pdimport numpy as np# Load the datadata = pd.read_csv("/content/ADNI1_Complete_3Yr_3T_1_31_2024.csv")# Split the data into features and labelsX = data.drop("Group", axis=1).valuesy =...

View Article


Azure function local debugging problems

Whenever I'm creating a function app locally (with vscode) the project gets created,When I debug locally the az function, the debugger runs successfully,When I add any library in the requirements.txt...

View Article

Get list from pandas dataframe column or row?

I have a dataframe df imported from an Excel document like this:cluster load_date budget actual fixed_priceA 1/1/2014 1000 4000 YA 2/1/2014 12000 10000 YA 3/1/2014 36000 2000 YB 4/1/2014 15000 10000 NB...

View Article


How to cre and Sqlite3 database and tables

I am trying to create a web app using python and flask.I got my routing parts done, and now I am trying to set up a Sqlite3 database to store users information.The following is my code.from flask...

View Article

Allocating Switch Ports to Users Based on Percentage Shares

I'm working on a problem where I need to distribute ports on network switches among users according to specified percentage shares. Given a total number of switches with varying port capacities (e.g.,...

View Article

I translated the python code into javascript, but although it was successful,...

I translated the python code into javascript, but although it was successful, it does not work, why?The python code is a bit long, but since the part I need is the request part, I only took the request...

View Article
Browsing all 13861 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>