Category "python"

How to make the dataframe faster ? either by using dictionary or numpy?

I am new to data structures and I would like to make my code faster (this is just part of a bigger code). Using dataframes while looking up variables is slowing

How to add an Ontology IRI with the Python rdflib library?

My problem is described here but the (maybe old) proposed solution does not work for me! https://github.com/RDFLib/rdflib/issues/817 I would like to use rdflib

Pandas: Creating multiple indicator columns after condition with dates

So I have a data set with about 70,000 data points, and I'm trying to test out some code on a sample data set to make sure it will work on the large one. The sa

GeoPy SSL Certificate Verify Failed: certificate has expired (_ssl.c:1056)

UPDATE: Okay, so I was finally able to figure it out. Apparently I accidentally installed something through pip before leaving the other day, which had some sor

Left join pandas if column value is within a certain range?

I was wondering if it were possible to merge two datasets if the values were in a certain range of each other. For example, If I want to join on zip codes, then

Calculating joint probabilities from two tensors of different sizes in pytorch

I am trying to calculate joint probabilities from two tensors.. It's a little bit confusing for me. Suppose we have : a = torch.Tensor((10, 2)) b = torch.Tensor

Trying to Upload database file using python requests and sending to django API

Hi I have a database file. I want to send this database file via python requests post method to my django server and store this database file somewhere in my se

Error building kivy app for android with buildozer

I am fairly new to Kivy and app development in general. I made a simple app and wanted to try creating an apk file using buildozer. I ran the following command:

How to Convert or Solve a Non-Linear Optimization Problem with Non-Linear Objective Function & Constraints

Overview I am working on an order allocation problem with variable and fixed costs. The initial formulation of this problem was a linear optimization, but when

Is there a good way to cache apt and pip packages on my home network without changes to my clients?

I am testing and building a lot of containers over a somewhat slow internet connection. Every time I test a rebuild it has to re-download all the apt and pip pa

How to Convert or Solve a Non-Linear Optimization Problem with Non-Linear Objective Function & Constraints

Overview I am working on an order allocation problem with variable and fixed costs. The initial formulation of this problem was a linear optimization, but when

Using python 3.10, but pylance still says "alternative syntax for unions requires python 3.10 or newer?"

So I just upgraded python to 3.10 for the new features, and when I do import sys; sys.version using the ipython console in vs code, it prints python version 3.1

Using python 3.10, but pylance still says "alternative syntax for unions requires python 3.10 or newer?"

So I just upgraded python to 3.10 for the new features, and when I do import sys; sys.version using the ipython console in vs code, it prints python version 3.1

Django Github CI cannot connect to mysql 'db'

Issue When trying to setup a Github action to test a Django project automatically, we ran into an issue with the django.yml setup. Whenever we ran the .yml, we

WARNING:tensorflow:Compiled the loaded model, but the compiled metrics have yet to be built. `model.compile_metrics` will be empty until you train

I am trying to run a yolov4 + DeepSORT object tracker on tensorflow. However, when I attempt to run save_model.py to convert the darknet weights of yolov4 to a

Django Github CI cannot connect to mysql 'db'

Issue When trying to setup a Github action to test a Django project automatically, we ran into an issue with the django.yml setup. Whenever we ran the .yml, we

Cannot install Atom packages. npm ERR! code E500

I've just installed Atom and I wanted to install some packages. However, I couldn't do it due to this error: Installing “[email protected]” failed.Hide

In Python how can I overwrite the class attribute of an inherited class, where that attribute is itself an instance of a model?

As in the title, I have a base class ListView, with a Serializer attribute that needs overwriting. For each of my django models I create a child ListView class

Python to Powerpoint: Export svg to a pptx file

I was experimenting with the python-pptx library to automate the process of adding images to my presentations. I used code such as: from pptx import Presentatio

How to install PyQt5 on M1 arm64 architecture?

I have an M1 mac, but I've noticed that whenever native python is running any automation script (like PyAutoGui) it progressively gets slower and slower, almost