Category "python"

What is the Python equivalent of a Promise in JavaScript?

I am trying to understand what would be the best code structure or a design pattern that would do the following: Have a function named get_data that would start

pandas | list in column to binary column

I have the following dataframe: +------------+------------------+ | item | categories | +------------+------------------+ | blue_shirt | ['red', 'wh

Chainladder: does it work with multi-triangles with non-aligned valuation periods?

Trying to extract properties from the triangle / development class(e.g..age_to_age) give it was parameterized with multiple triangles each with different valuat

Django rest framework: Unit testing post request gets status code 400

I'm doing some unit tests in this restaurant app, and the API request to cancel orders returns code 400 when running "manage.py test" command, but doing the sam

Linear Regression statsmodel: Missing a required outcome variable

I am using statsmodel to build a linear regression for salary. It's giving me an error that says I am missing a required outcome variable. Can you tell what I

How to find current upper Bollinger band in pandas-ta

I have a CSV file having columns Instrument, Date, Time, Open, High, Low, Close I want the rows having Current close greater than current upper Bollinger band(2

Removing a list in a list of lists if a condition not satisfied

I have a list of lists. I want to remove lists if the lenght of intersection of values in the list with previous lists is more than one. For example A=[(1,2,3,4

Selenium TypeError: __init__() got an unexpected keyword argument 'service'

I'm refactoring my app from procedural code to OOP. I am trying to do this Driver class. UPDATE: this works in Windows but not in Mac. # IMPORTS from sys import

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":".ui flu~"}

This is the code I use: import requests as r, sys as sus, bs4 as bs, webbrowser as wb from selenium import webdriver as wd dr = wd.Chrome() b = r.get("https:/

Can I Create USDT Wallet With Python

I want to create USDT wallet with python. Than I want to check wallet periodically and send usdt another wallets. I google it but I can't find anything. Any lib

How to make the bot send a random photo to aiogram?

I need to force the telegram bot on aiogram to send a random photo to the chat, how can I do this. Thanks in advance for your reply

Mix second audio clip at specific SNR to original audio file in Python

I have two audio files that I would like to mix in Python. I'll refer to the original audio as "Audio A" and the audio to mix is "Audio B". I am able to add wh

Convert list of interfaces from show vlan into full name list line by line

I need to take list of interfaces from show vlan: gi1/0/1, gi1/0/2, gi1/0/3, gi1/0/5, gi1/0/7, gi1/0/10 gi1/0/11, gi1/0/13, gi1/0/15, gi1/0/17, gi1/0/19 and ge

how to have multiple user types in django

this app is a school management system with django i have three types of user in my web app, my problem is how to authorize these and give them permissions. use

custom method for voting bewtween multiple csv files

I have 3 (or more) Dataframes with this structure: ID Percentage 00001 3 00002 15 00003 73 00004 90 ... ... each csv have unique predicted percentage values a

unable to create web_app button aiogram

Good afternoon, an update has recently been released in telegram and added web_app buttons. leading to the "site" in the telegram itself, the documentation says

Why is the mean = 0 to calculate the confidence intervals of a distribution when using stats.norm?

I somewhat understand how to calculate the Confidence interval in this manner but why is it that in this code, they used the mean=0 within the stats.norm se = n

Heroku add folder to PYTHONPATH

Hello) My project has the following structure: app/ - api/ - ..some_folders/ - web/ start.py ... some files ... - run.py Procfile requirem

Why is my tensorflow model transforming binary classification labels from 0 and 1 to .7?

I have been working on a tensorflow model that predicts short term positive and negative trends in the stock market using momentum indicators. I have the model

convert csv to netcdf in Python

Hi I have a CSV file that is for several monitoring stations that have measured isotope data repeatedly over a period of time. Country Latitude Longitude