Category "python"

Scipy's minimize function doesn't converge with a callabe jac

i've been trying to minimize a absolute qudratic error given by : quad_error = ((prediction-obs)**2).sum()/(obs.size-1) Where prediction depend if a number of v

plotting white stuff over a plot in python

I've got some trouble with plotting white spans over a plot. I've created and plotted a given function y(x) and defined some "forbidden" regions, corresponding

win43.client restrict combining many filters

I'm trying to read outlook emails via python, have code like below: import win32com.client import os from datetime import datetime, tim

Flask select which form to POST by button click

I'm trying to have only one of two forms POST depending on which button from a btn-group is selected. Currently all of the forms POST with no issue, but there a

YAML Pipeline Scan python

I have to write a python script where I need to parse YAML file and produce the list of steps that includes the image version for example: this is the step Step

How to a output message in separate message boxes for a chatbot

So I'm trying to build a chatbot using python, flask, nlp, js. But I'm new to js and just started to learn about it. Output How should I output this prediction

python workaround gpiozero when_motion with multiple sensors

i'm trying to listen on 3 motion sensors, each one triggering its own sound i'm using when_motion because it's creating a thread, so i can do other thing while

Add a new column for color code from red to green based on the increasing value of Opportunity in data frame

I have a data frame and I wanted to generate a new column for colour codes which stars from red for the least value of Opportunity and moves toward green for hi

Is there a way to concatenate multiindex Pandas Dataframes with different column levels?

I am reading data from some csv files and a typical dataframe looks like this: Type Animal Animal Animal Color Black Black Red Value 0 0 0

Efficient way to know region of a coordinate

everyone, I want to know if there is an efficienct way to know if a coordinate locate in a region. Just like picture below. I want to know each coordinate locat

Output the Tuesday 6 weeks in the future in Python?

UPDATE: post edited to add answer to end of post Core Question Using Python, how do I output the date of the Tuesday that occurs 6 weeks after a certain date ra

Fitting two voigt curves, one after the other using lmfit

I have the following emission spectra of Neon collected on a Raman (background subtracted data): x=np.array([[1114.120887, 1114.682293, 1115.243641, 1115.80

Please how do i split this list using the split method in python

Edited I am trying to scrape avg_ratings, ratings and published year on goodreads so i can put them in a separate list import requests from bs4 import Beautiful

How can I Insert multiple rows with one query

I made a code allowing me to GET data from an API and insert it into a database. But I encounter a problem my api contains about 20 million data and to insert e

Building wheel for scikit-surprise (setup.py) ... error

I am getting this error when trying to install surprise libary in python. Does anyone know how to solve it ? Collecting surprise Using cached surprise-0.1-py2.p

How to change URL for beautifulsoup scraper every time the program runs (without doing it manually)?

I have the following code to scrape Reddit usernames: from bs4 import BeautifulSoup from requests import get from fake_useragent import UserAgent

Python find indices of subarrays which are continuous and increasing with difference of 1

The input is always strictly increasing. I could write this with a for loop and lots of if-else conditions, but is there some simple way? Here is an example: in

How to wait for translated text to appear in DeepL.com

After entering original text in DeepL, it takes 1-2 sec for translated text to appear. I'm unable to get translated text with TimeoutException. I've tried to Sy

How to send scheduled email with Crontab in Django

I like to send scheduled emails in Django with Crontab. I made a very simple app to test how can I send an email in every minutes (just for testing purposes). I

Tweepy is throwing an error when I try to upload an image. (AttributeError: 'dict' object has no attribute 'media_id_string')

import tweepy import os from PIL import Image consumer_key = "hidden" consumer_secret = "hidden" access_token = "hidden" access_token_secret = "hidden" auth =