Category "python"

Append column of arrays in Pandas

I have a dataframe of arrays such as: | A | B | C | |:---- |:------:| -----:| | [0,1,2,3] | [1,2,5,6] | [0,1,4,5] | | [0,0,6,3] | [0,2,0,4] | [3,8,7,1]

how can I solve this circular dependent imports in order to execute many to one insert

I have the following two models in several files: routes/camera/model.py from services.db import db from dataclasses import dataclass from routes.project.models

Django converting isoformat string datetime to tuple and rising error

I'm trying to update two datetimefields for the Skill entity in my db. I'm sure I'm passing an isoformat datetime string. When creating instead of updating ever

spatial regression in Python - read matrix from list

I have a following problem. I am following this example about spatial regression in Python: import numpy import libpysal import spreg import pickle # Read sp

Split work between writing output from .exe and reading the output

I have a simple .exe downloaded from the apple app store. It gives real-time updates on crypto prices and their percentage change. I am extracting percentage ch

How to convert the elements of a python list of lists?

I have a python list (vals) containing lists of strings like this: [['540.0 ', '0.0 ', '0.0 ', '162.0 ', '2.5 ', '1040.0 ', '676.0 ', '28 ', '79.99 \r'], ['54

PYTHON Left Join Based on Partial Matches of Column

I have two dateframes: df1 = pd.DataFrame([ ['ABC, TX', 'P1'] , ['NA BCD, CT', 'P2'] , ['CDE, MN', 'P3'] , ['CDE, MN', 'P4']

Join by specific length of character [closed]

I want to join items in a list of lists based on these conditions: Item 1 is exactly 6 characters of length, and Item 2 is exactly 4 character

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