Category "python"

Getting SettingWithCopyWarning with iloc or loc when some filtering is done on the dataframe wit regex [duplicate]

I have the following statement to compute the mean of three quiz scores and create a new column based on the computed mean: scores.loc[:, 'Ave

How to POST multiple images to FastAPI server using Python requests?

I would like to send multiple images to FastAPI backend using Python requests. Server side from fastapi import FastAPI, UploadFile, File from typing import List

How to make the markings on y-axis more dense in a bar graph in python

I am plotting a bar graph in python in the following manner: # importing package import matplotlib.pyplot as plt import pandas as pd # create data df = pd.Da

How to calculate coefficients, solutions etc. in quadratic function with limited inputs in Python

I have a problem. I want to calculate everything in the quadratic function. equations for reference: ax^2 + bx + c a(x-p)^2 + q I made 8 possible inputs in tki

Adding a value to a range of values in an array in Python without using a for loop

I'm trying to learn Python and I have run into a problem. I am attempting to complete the Array Manipulation challenge on hackerrank. A part of solving it requi

How to groupby two columns, not considering order of values there?

I have a dataframe: val1 val2 val3 a b 10 a b 2 b a 3 f k 5 f k 2 when i do df.groupby(["val1", "val

Joining multiple thread in Python is not blocking the main

Hello I'm trying to block the main until all the threads are done. Apparently even by executing the .join() method, the main sometime doesn't wait all the threa

How to keep Microsoft teams status active?

In Microsoft Teams, the status changes to "away" after a while being inactive. Is there any way in Python to keep it active all the time?

Speed differences between QStandardItemModel and QAbstractTableModel?

Can anyone explain the following: I have 2 scripts for loading a pandas dataframe in a tableview which has a filter field. The one with the standard model loads

How can I substring to specific character in pandas?

For example, I have 2 columns(1,2), and in table 2 I want to fetch everything until " character. I wanted to do something like this: df.columns = ['1','2'] a =

How can I retain background after dilating text in image

import cv2 import numpy as np # Load image, grayscale, Gaussian blur, Otsu's threshold image = cv2.imread('1.png') gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRA

Is there any way to add components to jira issue using python jira client?

I was working on a project where I have to update jira issue fields like components , epic links,etc. I am using jira python client(https://pypi.org/project/jir

python-telegram-bot stops working after 5 min

I have created a telegram bot that sends screenshots of the browser webpage. I have used python-selenium package in order to connect browser with telegram-bot b

Best Practice in Python: Class Object with helper variables - delete helpers after use

I want to have a Class with only one argument to it. Based on that argument a couple of calculations should take place aiming at setting a specific attribute fo

fastapi using ORM not able to convert to pandas

I've been developing a fastapi way to query my database, instead of directly using SQL with pg. For some reason, I'm having issues converting the ORM query retu

I'd like to get the episodic rewards in csv format in stable baselines 3

I want to retrieve the data after every episode, I've read the documentation that you can use, stable_baselines3.common.monitor.ResultsWriter but I don't know h

Unable to get imu streams in my realsense camera D435i

I am trying to get IMU data from D435i camera but unable to do so. Browsing various github issues, I got the code snippet which is straight forward but for some

How can I mass lock/unlock channels in discord.py

Hello stack overflow users, I am trying to achieve mass-locking/unlocking channels in this coding language. The commands return no error, but it doesn't lock al

nlpaug wordembeddings model not working PermissionError: [Errno 13] Permission denied: '.'

I am following these docs to try and do random word insertion: https://nlpaug.readthedocs.io/en/latest/augmenter/word/word_embs.html However when simply trying

Python regex remove dots from dot separated letters

I would like to remove the dots within a word, such that a.b.c.d becomes abcd, But under some conditions: There should be at least 2 dots within the word, For e