Category "python"

flask_sqlalchemy keeps trying to connect to localhost database instead of the remote one

I'm trying to use the flask_sqlalchemy library in order to connect to a PostgreSQL server on my remote Ubuntu machine, but my app keeps trying to connect to the

flask_sqlalchemy keeps trying to connect to localhost database instead of the remote one

I'm trying to use the flask_sqlalchemy library in order to connect to a PostgreSQL server on my remote Ubuntu machine, but my app keeps trying to connect to the

subprocess.run produces different result if launched from Python, versus Matlab

I have a Python 3 class that creates input to send to a fortran program (xfoil). I am using subprocess.run to launch the fortran binary and send the command inp

no such file libmariadb.3.dylib error when importing MySQLdb on mac M1

I migrated my data to M1 Monterey MacOS from intel macmini. I was happy to use django and mariadb until I installed a package using homebrew. I installed homebr

Why does this keep returning the last value of the dictionary?

So i'm practicing my nested dictionary skills with this data: content = {'results': [ {'_class': 'question', 'course': {'_class': 'course',

Find the best feature value to reach the largest predicted value without iterating with sklearn estimator

I have a complex system with a lot of parameters, each parameter interact with others. I could have some parameters values of this system at one time ("a", "b",

How to integrate backspace functionality in a program?

I have created a program that prints a character whenever that character is pressed but when i press "backspace" button to remove the last entered character the

How do I type hint a method with the type of the enclosing class?

I have the following code in Python 3: class Position: def __init__(self, x: int, y: int): self.x = x self.y = y def __add__(self, oth

Trying to understand this potentially virus encrypted pyw file

Today I realised this .pyw file was added into my startup files. Though I already deleted it, I suspect what it may have initially done to my computer, but it's

Simulating expectation of continuous random variable

Currently I want to generate some samples to get expectation & variance of it. Given the probability density function: f(x) = {2x, 0 <= x <= 1; 0 othe

How to solve two first order ODEs in which one of the variables contains a list of elements?

I need help with solving three first-order ODEs using the scipy.integrate.ode module with the integration method of the Runge Kutta Method. My problem is that I

Converting Geojson to kml using Python

I can convert it kml/kmz to geojson also, creating kml from geojson.. I tried with the below libraries Shapely kml2geojson geojson Source code below.. import j

Why are my box plot and probability plot overlapping

I'm trying to plot Histograms, Probability Plots, and Boxplots, however, boxplots and prob plots overlap: This is the code in Python (Jupyter Notebook): def ou

How to get a proper signature to authenticate to private websocket in Wootrade

I am trying to authenticate to private websocket on wootrade I am keep getting this error : { 'errorMsg': 'signature error', 'event': 'auth', 'id': '1

Argparse: Ignore dashes in unknown arguments or collect values (potentially starting with dashes) until the next known command

I have a Python script that will later call multiple Bash scripts with supprocess.run. When calling the Python script, the user should be able to specify lists

How to count number of events in a dataframe before and after a given date?

I'm trying to identify individuals who have events before or after events of their first occurrence of an event of a specific type. For example, I'm interested

How to plot data in panda dateframe to histogram?

I have a dataset containing various fields of users, like dates, like count etc. I am trying to plot a histogram which shows like count with respect to date, ho

Pandas DataFrame : How to groupby and sort "by blocks"?

I'm working with a DataFrame containing data as follows, and group the data two different ways. >>> d = { "A": [100]*7 + [200]*7, "B": ["one"

Pyscript in Django application

I am wondering if we could use pyscript on HTML pages inside a Django project. I'd tried to use it but unfortunately, it doesn't work. this is the code : <he

How to rethink the architecture of my Python project containing multiple async interfaces

I'm developping a Twitch Bot for approximatively a year now. Over the time, the bot became bigger and bigger to add features. Now the bot can manage multiple in