Questions tagged [python]

Python is a dynamically typed, multi-purpose programming language. It is designed to be quick to learn, understand, and use, and enforces a clean and uniform syntax. Please note that Python 2 is officially out of support as of 2020-01-01. For version-specific Python questions, add the [python-2.7] or [python-3.x] tag. When using a Python variant (e.g. Jython, PyPy) or library (e.g. Pandas, NumPy), please include it in the tags.

Filter by
Sorted by
Tagged with
0 votes
0 answers
6 views

Download files from url using Python requests

I have a generated url that will need to open up the browser to download the file from the server. I am trying to simulate this download using Python requests library import requests url = r'https://...
ReverseEngineer's user avatar
0 votes
0 answers
5 views

Matplotlib fill_between one line and infinity

Is there a way to fill the figure with color between one curve and infinity ? I am looking for something like ax.fill_between( x, y, 'inf' ) I have looked at Matplotlib tutorials and found something ...
Altaris's user avatar
  • 13
0 votes
0 answers
14 views

randomly generate a matrix with fixed number of non zero values using python

I want to generate a random matrix (min value=0, max value=25, steps=5) with N rows and 6 columns, where the number of non-zero values (k) given as input. Example: Input: N=2 K=8 Output (result): [[ 5,...
mlri's user avatar
  • 1
0 votes
0 answers
5 views

Images not showing on production after i deployed my django mvt app to heroku

My django mvt app seems to be working fine on development but not on production, everything works fine except that the images are not displaying, that is they are not been served on production ...
Ayinlade Sikiru's user avatar
0 votes
0 answers
13 views

Pandas read_csv with seperators in header names

i've got a text file similar to this: @ some comment @ some comment @ [...] @ some comment * NAME S BX BY bla foo bar foo "ACF" 1 2 3 "BGB" 4 5 6 "CSD" 7 8 ...
Marvin Noll's user avatar
0 votes
0 answers
10 views

Pythonnet not able to import DLL because RGiesecke.DllExport.Metadata not found

I'm using Python 3.11.5 and Pythonnet 3.0.2 to import a DLL provided by my company to run some C# functions in a Python environment. I was provided a script that would just do this: import clr clr....
J. Maria's user avatar
  • 362
0 votes
0 answers
11 views

Install specific dependencies from pyproject.toml

I am using poetry package manager for python. I would like to install only 2 specific dependencies from dev dependency list - flake8 and black. How it can be done? My pyproject.toml file: [tool.poetry]...
Fusion's user avatar
  • 5,060
0 votes
0 answers
8 views

Python TLS socket: how to detect connection closed by server due to certificate failure?

Trying to write a TLS client using Python 3. Can't figure out what's the proper way to detect and handle connection rejected by server. If the TLS server requires client certificate but the client ...
RichardLiu's user avatar
  • 1,902
0 votes
0 answers
7 views

discum reads embed and clicks

def start_bot(token , channelID , user_id ): bot = discum.Client(token=token) @bot.gateway.command def anigame2(resp): if resp.event.message or resp.event.message_updated: ...
Hashirama Uchiha's user avatar
0 votes
0 answers
9 views

Conda build fails with "TypeError: create_function()" error

I am running conda build using a recipe that downloads the tar.gz file from PyPi. This fails with the following error message: TypeError: create_function() got an unexpected keyword argument 'narg' ...
Jamie's user avatar
  • 11
0 votes
0 answers
29 views

Applying a function to a Pandas Dataframe

I have this code with me. And I need to pass a pandas data frame in it as a parameter. It returns errors. def williams_ad(data, high_col='High', low_col='Low', close_col='Close'): data['...
prashanth manohar's user avatar
0 votes
1 answer
18 views

Insert series ending at last valid index in dataframe column. Pandas

Given a dataframe that contains a combination of null and numeric values in which each series of numeric values is always located together and is never interspersed with nulls. Such as: df1 = pd....
r0bt's user avatar
  • 483
0 votes
0 answers
4 views

Resizing Windows according to pyqt5 window like windows copilot

I have created a ui in pyqt5 and what i want is that when i the window is maximized it pushes aside other windows and while it is maximized no other window can go behind it, something like the windows ...
OverKill's user avatar
0 votes
0 answers
7 views

How to make a tkinter appear and disappear based on a time condition

The question is related to these questions: How do I get rid of a label in TkInter? How to make a Label appear then disappear after a certain amount of time in python tkinter I am trying to create a ...
Meet's user avatar
  • 471
0 votes
0 answers
6 views

Yolov8 Backbone, How can i learn which backbone algorithm used my yolo model?

How can i learn which backbone algorithm used my yolo model ? could not find how to check it actually? is there any way to check it? How can i learn which backbone algorithm used my yolo model ? could ...
mahsum's user avatar
  • 1
0 votes
0 answers
16 views

pandas.to_xml() with nested xml blocks

I create table in PostgreSQL and insert to table nested XML(xml_part column): CREATE TABLE text_xml ( id numeric, xml_part XML ); insert into text_xml values (1, '<note><to>Tove&...
Alexex93's user avatar
0 votes
0 answers
8 views

How to extract underlined/highlited text from an image?

I have a bunch of words extracted from a particular image using Tesseract OCR library. After doing so, is there any way to detect words which are being underlined or they have a box around them? i ...
Rakhshan Zulfiqar's user avatar
-1 votes
1 answer
19 views

How do i fix Paramter 'self' unfilled occuring in Innit class

I have seen many "solutions" to this error online but I have not yet been able to find the actually solution to my problem. class vehicletest: def __init__(self): self.vehicles = ...
Pete's user avatar
  • 1
0 votes
2 answers
35 views

Compare between different categories across specific column

Is there a way to compare between different categories across specific columnn >>> import pandas as pd >>> A = pd.DataFrame({"col1": ['A', 'A', 'B', 'B'], "col2":[...
navee pp's user avatar
0 votes
0 answers
7 views

How to perform an inference on a Llava Llama model deployed to SageMake from Huggingface?

I deployed a Llava Llama Huggingface model (https://huggingface.co/liuhaotian/llava-llama-2-13b-chat-lightning-preview/discussions/3) to a SageMaker Domain + Endpoint by using the deployment card ...
Csaba Toth's user avatar
  • 10.1k
0 votes
0 answers
8 views

Detect delivery of whatsapp message using selenium

I had a whatsapp bot that send images and videos, but I couldn't get a way to ensure the attachements are sent. I have tried several ways to solve the problem, this is the last idea that I had is to ...
Ahmed Elbehairy's user avatar
0 votes
0 answers
22 views

Parsing string that looks like a list using ConfigArgParse

I am using Python 3.9.16 and ConfigArgParse==1.7. I have conf file like this: [conf] example = [something_in_brackets] I am trying to parse the config like this: import configargparse p = ...
Madoc Comadrin's user avatar
0 votes
0 answers
3 views

Spyder Startup command creates SparkSession object and *two* Web UIs

In my Spyder preferences, I have the following IPython console Startup command: from pyspark.sql import SparkSession ; spark = SparkSession.builder.appName("SparkExamples.com").getOrCreate(...
user2153235's user avatar
0 votes
1 answer
26 views

Activating existing virtual environment in WSL

I am a beginner in the process of learning Python. I have created a virtual environment and usually I activate it in Window Power Shell using the command ll_env\Scripts\activate Recently, I installed ...
jong's user avatar
  • 3
-1 votes
1 answer
19 views

I want to use pytest to test if a ValueError raises inside the constructor of a class [duplicate]

There is a class: class Foo: def __init__(self, bar: int) -> None: self.bar = bar if self.bar < 0: raise ValueError("bar must be positive.") ... ...
CHRIBUR_'s user avatar
-1 votes
0 answers
8 views

Calling notification.notify() raises "No Usable Implementation Found

This is properly executing when i run into my local system. But when i deployed into GCP, after that it generates this error. No Usable Implementation Found! Not found any solution. please help to ...
Anuj Darji's user avatar
0 votes
0 answers
4 views

PyGad GA calling the fitness function too often

I am using PyGad’s GA function to optimise a neural network. As part of the testing and de-bugging I added some code to the fitness function that would save each solution and its accuracy. I’ve set ...
whichedge's user avatar
0 votes
4 answers
66 views

Python list iteration not working with conditions?

I am a beginner in the python world and I really like this language so far! In my exercices session I've found the following one: "Use a loop to display elements from a given list present at odd ...
loveshadow's user avatar
1 vote
1 answer
35 views

Pandas groupby use while combining and inserting information on a column based on another column conditions

I have a dataframe like below: new_df = pd.DataFrame([('231', '2122', '1', 'some_text', 'agent_text_1', 'cust text_1'), ('231', '2682', '2', 'some_text', 'agent_text_2', 'cust ...
Bilal Sedef's user avatar
0 votes
0 answers
16 views

Formatting datetime64 dates as xticks

In a DataFrame I have column "Datum2" with datetime64 formatted dates (YYYYMMDD) that I want to use as xtick labels. My current plot looks liket this: I want to change the labels to show ...
Yeb0's user avatar
  • 13
0 votes
0 answers
6 views

Fix ValueError: endog and exog matrices are different sizes

Here is my part of code enter image description here f=0 for i in range(0,4): df = 0 counts = 0 df = data_frame_list[i] counts = df['Headcount'].to_list() model_arima = ARIMA(...
Smriti Pradhananga's user avatar
0 votes
0 answers
13 views

Failing to install awswrangler or pyarrow due to an issue with CMake

I am getting this error while running pip install awswrangler -- Could NOT find Protobuf (missing: Protobuf_LIBRARIES Protobuf_INCLUDE_DIR) CMake Error at CMakeLists.txt:63 (find_package): ...
Lautaro's user avatar
0 votes
0 answers
6 views

How to do shorting with multiple column using Edge DB

I'm stuck in EdgeDB query, one of my project's functionality is sort data by multiple columns. I would like to be able to specify any column, such as URL, endPointType, or any other column with ...
Sneh Panara's user avatar
1 vote
0 answers
12 views

Selenium Manager not working on AWS Lambda

trying to run a lambda on AWS that uses selenium and chromedriver uploaded a layer that contains selenium v4.13 and chromedriver v2.24 I understand that this version of selenium contains selenium ...
TheGunners's user avatar
-1 votes
0 answers
17 views

What is the best way to run a .NET console application from a Python desktop application?

I have a .NET console application which, in turn, sends requests to a server. I also have a desktop application, written in Python, that needs to send requests to the same server. As things are, it is ...
razumichin's user avatar
0 votes
0 answers
9 views

Transformers pipeline inference for ever gradually fill ram

I have trained a BERT model and using it for inference on a windows server on CPU. for the incoming data I apply pipeline on a batch of text and repeat it forever in a while loop. tokenizer = ...
keramat's user avatar
  • 4,328
0 votes
0 answers
10 views

Gradio pop up display on success

Here is the below sample code for gradio app mounted on FAST API app. import gradio as gr from fastapi import FastAPI from starlette.responses import RedirectResponse from starlette.requests import ...
Shubhank Gupta's user avatar
-5 votes
0 answers
29 views

What is the code to do the following question in the image attached in the in 'python' [closed]

[Question image](https://i.stack.imgur.com/TKVfl.jpg) I need the code For the question
Gokul Mohan's user avatar
0 votes
1 answer
48 views

How to generate an auth token and list out the resource groups in azure using python?

I have tried with the below code: from azure.identity import ClientSecretCredential import requests subscription_id = 'MYSUBID' client_id = 'MYCLIENTID' client_secret = 'MYSECRETVALUE' tenant_id = '...
Navi's user avatar
  • 1,010
0 votes
0 answers
8 views

Attempted to initialize RESTObject with a non-dictionary value when adding file to GitLab project using python-gitlab

I am trying to create GitLab projects through GitLab CI pipeline by importing the GitLab export tar.gz file using python-gitlab library. The new project gets created but does not get initialized with ...
Ashmeet Pahwa's user avatar
-1 votes
4 answers
42 views

tuple object has no attribute tick

I am making a game from python by looking some tutorials i am getting some errors below is the code : import pygame import time pygame.init() WIDTH, HEIGHT = 800, 500 pygame.display.set_mode((WIDTH, ...
Shejal Pal's user avatar
0 votes
0 answers
10 views

Text box and button not appearing in the steamlit app

Hello there i am using streamlit and ifcopenshell to create an app that processes IFC models. I hit a wall in the initial build up of this app. I am trying to output a text box and an apply button ...
H. Ach's user avatar
  • 35
-1 votes
0 answers
21 views

How to Identify Font Type from Text Using Python? [closed]

I'm looking for a way to identify the font type used in text using Python. For example font type for "하이푸디" is Malgun Gothic. you can find it using ms word when you click on text. but how to ...
Gayan Jeewantha's user avatar
0 votes
0 answers
9 views

Prevent ReferenceError in multi-page dash application

I am developing a multi-page dash application. My project structure is as below: - project/ - pages/ - home.py - graph.py - app.py - index.py On app.py page, I have a theme switch ...
winter's user avatar
  • 525
-1 votes
0 answers
14 views

Can't find variable: PaymentAutofillConfiguration. 2

"We are facing the Reference error in our code since 2nd of June 2022 on our sentry logs. Moreover its only happening on iOS (iphone) devices only.. We are using stripe and react-js to create our ...
Aqsa Bibi's user avatar
-1 votes
0 answers
23 views

Create some table type thing in python

I want to create something like this using python I also want it to be customizable. Which library should I use? I have created enough code to generate random numbers and store them, and now i want ...
Akshat Jain's user avatar
0 votes
0 answers
10 views

Failed to decode image from camera with opencv - Packed YUV 4:2:2, Y:U:Y:V (YUV2)

I am trying to read data from CCTV camera connected via some converter to computer (converter output is USB) - hardware details are unknown. In VLC player, I can connect and see the video clearly via ...
matousc's user avatar
  • 3,718
0 votes
0 answers
12 views

Persist newly calculated value in delta lake - Databricks operation MERGE fails

Situation description I'm working with Databricks on Azure and perform an MERGE operation. I'm loading the initial delta table dt with spark.read.format("delta").option('MergeSchema',True)....
mat.tho's user avatar
  • 194
-1 votes
1 answer
13 views

Unable to locate element error while trying to locate a textarea input box using Selenium through Python

I´m trying to find a text box on a webpage with Python and Selenium. I Tried By.css_selector, by ID, by name and with the iFrame in view but the message is always: Unable to locate element: textarea....
Ivy Johnson's user avatar
0 votes
1 answer
21 views

What is the solve for "Strings nested within an f-string cannot use the same quote character as the f-string prior to Python 3.12 Pylance" in vscode?

I am a begginer python programmer and I got a problem while making a programme which is: "Make several dictionaries, where each dictionary represents a different pet. In each dictionary, include ...
sakibmouin's user avatar

1
2 3 4 5
43313