Skip to content

How to add Python and pip or conda packages to DDEV

I need to execute a Python script inside the Ddev web docker image, but am having trouble figuring out what Debian python libraries are required to get Python binary with additional py package dependencies working. Answer Python 2 on DDEV You really don’t want to be using Python 2 do you? (See caveats 1 &…

Can I improve this code to a more oriented OOP paradigm?

I am improving this code to a student, here is the image: So I rewrite this using list compreenssion and oriented to a formal class, so the second question is: Can I improve yet more this code? Answer Yes you can improve your code to be more “Object Oriented”. It doesn’t make sence that Alun…

Python does something every 5 minutes

i need to check data on an API. The API is refreshed with new data every 5 minutes (10:00, 10:05, 10:10 etc…) I don’t want to use time.sleep(300) because i want my script to do something at 10:05:03, then 10:05:03 etc. and not 5 min avec the script started (maybe it started at 10h12 How can i buil…

Recenter plot after set_xdata and set_ydata

I can use the set_xdata and set_ydata functions to update an existing matplotlib plot. But after updating I want to recenter the plot so that all the points fall into the “view” of the plot. In the below example, the y data keeps getting bigger but the zoom level of the plot remains same so the da…

Simple Linear Regression not converging

In my attempt to dig deeper in the math behind machine learning models, I’m implementing a Ordinary Least Square algorithm in Python, using vectorization. My references are: https://github.com/paulaceccon/courses/blob/main/machine_learning_specialization/supervisioned_regression/2_multiple_regression.pd…