Category "python"

Function minimization with non-linear constraints using scipy.optimize.minimize 'SLSQP' method Error

I'm trying to minimize a maximum likelihood function with non linear constraints: #Maximum Likelihood import math from scipy import optimize #Define functi

line() got an unexpected keyword argument 'reuse_plot'. Not sure what this means

I am following a tutorial online to use Python to determine financial returns. I am getting an error "TypeError: line() got an unexpected keyword argument 'reus

When one of my column in dataframe is nested list, how should i transform it to multi-dimensional np.array?

I have the following data frame. test = { "a": [[[1,2],[3,4]],[[1,2],[3,4]]], "b": [[[1,2],[3,6]],[[1,2],[3,4]]] } df = pd.DataFrame(test) df a b 0

Negative dimension size error in tensorflow [duplicate]

so I have 2 images, img1 and img2 both with shape=(20,20), to which I expand_dims to (1,20,20) 1 being batch size and feed them to the network

Sending a message to twitch chat doesnt work

I'm creating a simple Twitch bot for personal use. I'm using twitchio.ext commands. Everything works fine, I'm connected, I'm able to print all the messages fro

Python: Get Surfaces from convex hull

I am new to 3D-Calculations and i searched for a while, but couldnt find any solutions (maybe I am using the wrong search terms). So i have different 3D-Point-C

Error uploading file to google cloud storage

How should the files on my server be uploaded to google cloud storage? the code I have tried is given below, however, it throws a type error, saying, the expect

How to select all the rows with 0

I have a dataset where I have some 0 values in it. I want to print all the rows having 0. I was able to print a single column, but can't find a way to print al

Mac doesn't read pytube package

I've a problem while making a YouTube downloader with pytube. I installed the package with pip3 install pytube python3 -m pip install pytube And I have python3

Python multiprocessing, parent process hangs at recv after child process raises exception before send

Python is definitely one of the worst languages for parallel processing. Just finna get the parent process to throw an error when the child process fails. Inste

How do I select values from one array based on a boolean array?

Let's say I have 2 numpy arrays, with the same 1200x1200 shape. The first one contains boolean values. The second one is an image, that was converted to boolean

Deploying ML model on Streamlit

I have a code that basically takes in a csv, which can be uploaded from streamlit and then pushes out a classification prediction. Just as a context I use xgboo

Filter rows in dataframe based on value counts [duplicate]

I have a large dataframe/Questionaire df (871 x 24) containing a column named "Identifier" which stores an unique ID for each of the participa

Save multiple/distinct .CSV files after for loop execution

I have 65 xml files that I need to convert to .CSV, and save each converted file as a separate .CSV file. I have tried using a for loop but am not having any lu

my python package can be installed on my local conda env but can not be installed on other envs or systems

I have created my own python package and uploaded it in https://test.pypi.org/ which installed and worked fine in my conda virtual environment but when I want t

Quantify longest axis and width of irregular shapes within a single image

Original question I have about 80-100 images such as (A). Each image is composed of shapes that were filled with black color after marking the outline in ImageJ

How can I set up a VirtualBox interface using a Python library in 2022?

I have a local installation of VirtualBox running on my host machine, which is running Windows 10. I am able to start and run a virtual machine of Ubuntu via th

brownie AttributeError: 'NoneType' object has no attribute 'getEntranceFee'

Macbook Pro : Monterey Intel Core i7 Brownie v1.17.2 I am learning solidity according to reference(https://www.youtube.com/watch?v=M576WGiDBdQ&t=25510s). Wh

Python Json.decoder.JSONDecodeError: Expecting ',' delimiter:

I'm trying to load a dictionary into json but I'm getting error. strsdc = ''' {"ext":{"amznregion":["useast"],"someURL":"https://som_url.com/x/px/Iyntynt/{

splitting strings by list of separators irrespective of order

I have a string text and a list names I want to split text every time an element of names occurs. text = 'Monika goes shopping. Then she rides bike. Mike likes