Category "python"

else cant read the variable "msg"

so basically I have some code that will look at a Reddit page and get the title, link, current upvotes, and how long ago it was posted. And if the links aren't

Want input given in 1st class to be accessed by other class

I am very new to python so please ik the code is not so professional and stuff class VMReader: def __init__(self, filename): filename = input("pleas

local variable 'allLibrary' referenced before assignment

I can't seen to understand what the issue here is, I am getting an error that local variable 'allLibrary' referenced before assignment, Please help @app.route('

logistic regression; how to find the actual value of predicution (e.g. 3.5, 2.6). Due to model set up, y-pred is iether 1 or 3

I am currently coding a logistic regression. Here is my set up. X values - X-train/X-test based on count vectoriser. Y values - either 1/3 (boolean values for n

How to process files in FastAPI from multiple clients without saving the files to disk

I am using FastAPI to create an API that receives small audio files from a mobile app. In this API I do processing of the signal and I am able to return a respo

Scrapy only scraping and crawling HTML and TXT

For learning purposes, I've been trying to recursively crawl and scrape all URLs on https://triniate.com/images/, but it seems that Scrapy only wants to crawl a

AWS Aurora: bulk upsert of records using pre-formed SQL Statements

Is there a way of doing a batch insert/update of records into AWS Aurora using "pre-formed" Postgresql statements, using Python? My scenario: I have an AWS lamb

How to read a .log file in Python

Can you please help me with to code that I can use to read .Log file and then change '-' separated value to different column. The Content in the file is: Config

Flask application doesn't take into account the arguments in app.run()?

I have this issue : I use arguments to set the port and the debugger on like this if __name__ == '__main__': app.run(port=4200, debug=True) but it isn't ta

Parametric estimation of a Gaussian Mixture Model

I am trying to train a model to estimate a GMM. However, the means of the GMM are calculated each time based on a mean_placement parameter. I am following the s

unable to parse using pd.json_normalize, it throws null with index values

Sample of my data: ID target 1 {"abc":"xyz"} 2 {"abc":"adf"} this data was a csv output that i imported as below in python data=pd.read_csv('location',convert

Why does returned object not get attributes & methods of the class after __new__?

Index objects of diskcahe have the property _cache with Cache object inside it. Cache is created with few arguments from those in Index. Unfortunately, it can t

Use >= or ~= for compatibilty across systems?

My goal is a simple and proper way to export my venv. In the optimal case, the resulting requirements.txt works on all compatible systems. At the moment I use p

Hide all warnings in ipython

I need to produce a screencast of an ipython session, and to avoid confusing viewers, I want to disable all warnings emitted by warnings.warn calls from differe

Reducing number of levels of indentation for plural stemming code in python

My code works fine and it exactly does what it is suppose to do. However, it has too many levels of indentation. I wonder if anyone here has anyway to reduce nu

Scraping in <dt> and <dd> tags with bs4 ant python

How should i extract info i only need from <dt> and <dd> tags ? P.S and there is a lot of pages like that - hundreds Here is link for main page: ht

How can I convert radians to degrees with Python?

In the math module, I could only find math.cos(x), with cos/sin/tan/acos/asin/atan. This returns the answer in radians. How can I get the answer in degrees? He

Cannot Automate Dropping of Tables via Jupyter with Postgres

So I am trying to automate the dropping of TABLES in my Postgresql table I ensure the connections are working, I have done multiple queries previously, Now I wa

Login dialog PyQt

I nearly finished my application, when the customer asked if I could implement some kind of login form on application startup. So far I have designed the UI, a

how to scrap phobos website using open url

I'm trying to scrap phobos website using bs4 and getting 418 teapot error Here is my code ....I am getting error when i am using build_opener.open from url