Category "python"

DataFrame is highly fragmented

I have the following code, but when I run it I receive the error: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling fra

How can i submit a form with logged in user as default?

After you sign up, you are prompted to the login page, and after you login, you are redirected to another page that contains a form used for gathering additiona

Face detection return value without face

I' using haar cascade for face detection faces_haar = face_cascade.detectMultiScale(image, scaleFactor=1.3, minNeighbors=4, minSize=(30, 30), flags=cv2.CASCADE

Check if user input is between two floats - Python

I am currently working on a small project that will take a user input such as "50", and convert it to a float while also placing the decimal to the left, such a

Using multi character delimiter while exporting SQL table as text file using python

I am trying to export SQL table as multi-character delimited text file in python. I have tried using Pandas, but it is only supporting single character as delim

Installing Dlib gets into error requseting cmake.. and c++

I have installed cmake and configured via env and after that too dlib wont install i need dlib because i want to install face-recagation complete logs are here

how do I find the average of this array but only for the values that are not equal to zero in python [duplicate]

array([1500, 1520, 1540, 1590, 1590, 1600, 1600, 1560, 1560, 1560, 1580, 1520, 1460, 1510, 1520, 1320, 1320, 1300, 1300, 1320, 1320, 1320, 132

Discord bot won't go online

I've just started learn python and my discord bot won't go online. it just said " Process exit with exit code 0". And there's no error with the code. here's my

How to fix "shutdown: NOT super-user" when using a shutdown script in Python? [duplicate]

I got this script import os shutdown = input("Do you wish to shutdown your computer ? (yes / no): ") if shutdown == 'no': exit() else: os

What are the implications of using a variable declared outside of an async context as a placeholder for its return values?

I understand that if the variable was declared outside of the function, it should be marked as global. But what about this case? Is it safe to do something like

How to get python backtraces for python in valgrind

I'm trying to find a file descriptor leak in python code with valgrind but the backtraces look like this: ==2169309== Open file descriptor 11: ==2169309== at

How to use multiprocess when input is a torch.tensor with gradient?

import torch.multiprocessing as mp import torch import time class test(): def __init__(self,X,Y): self.X=X #.share_memory_() self.Y=Y

Could not get version for google-chrome with the command: powershell "$ErrorActionPreference='silentlycontinue' using WebDriverManager with Selenium

When running a python script with selenium and chrome driver I am getting the error below. I use the script in question for some a pretty simple automation runn

Plot timeseries whit seaborn

I want to plot these 4 time series through the seaborn Library in Python: Thank you for your help totalcc=[cluster_center_1 ,cluster_center_2 ,clus

Matplotlib: connect medians of boxplots with a line [duplicate]

I would like to have a line connecting the medians or means of my boxplots. I use matplotlib. Is there any way to achieve this easily? import

Cannot get out of infinite loop

The problem I am trying to solve is go through a list. In this list, if there is the letter "a", give me all those words. Once I have done that, pose the same

How to use pandas and numpy to compare two excel workbooks with multiple tabs?

I have two xlsx files that have multiple tabs. I need to compare values in each tab based on the tab name. (e.g. sheet1 in file1 needs to be compared with sheet

Reindex Pandas Series case insensitive (Combining matches)

I have a pandas series with string indices and integer values: (My actual series has >1000 entries) Count apple 1 bear 2 cat 3 Apple 10 pig 20 Cat 30 ApPl

running a python script with ptemcee (a package of Monte Carlo) in SBATCH / SLURM

I need to run a python script using sbatch / slurm The script works until the step which it must use the ptemcee (i.e. runs a monte carlo markov chain). In this

Multivariate Linear Regression, coefficients don't match

I'm facing a problem with different linear models from scikit-learn. There is my code from sklearn.linear_model import LinearRegression reg = LinearRegression()