Category "python"

vim select function in python

I am new to vim and recently I learned that it is possible to select a function in c with vip, and I was wondering if there is a way to do it with functions in

Need pandas groupby.count() or groupby.size.unstack() to output a dataframe I can use

So I need to count the number of occurrences of a value per year, per animal. I've managed to do it but it's outputting a single column kind of dataframe rather

what is the encoding method for message like this b'\xf1p&r\

I am testing sslkeylog python package to exact TLS master secret as below. I was successfully get the master_key, however the outoupt is hard to understand. Wha

PyQT how to change layouts size

I am trying to make a GUI that is very similar to Spotify using PyQT I've already designed the main window and I am struggling with applying the design to QT Cr

How can I efficiently bin 3D point cloud data based on point coordinates and desired bin grid size

I have a large point cloud in open3D and I want to basically make a 3D grid and bin the points based on which cube they are in. Other have called it "binning in

How to append parenthesis to the string text in python?

I have one string like "Article created on March 03 2021 for the some user" I want to convert that string to "Article created on (March 03 2021 for the some use

Entire Pandas Column Read in as NAN from read_csv()

I'm having trouble reading in my CSV file with Pandas. It's reading in a stock dataset which contains the Date and OHLCV columns, but for some reason, it's read

How to unmelt a completely melted table

I have this dataframe df which I have melted and then using pd.pivot_table I am able to get the table structure back at least looking at the rows it seems so -

Add variable to URL in Locust test

I'm been trying to figure out how to add a variable captured from a prior 'task' on Locust and add a variable to a new tasks GET request URL. The variable below

How can I make a def function with my "if" statements?

We were asked to make a function named temperature conversions that accepts an integer argument called temperature, a secondary string parameter called input un

Installing RTSP Server Python bindings on Linux

I am trying to install Python bindings of RTSP Server on my Linux camera. I have working Gstreamer, opencv. When I try installing the below, I get the following

Could not fetch URL https://pypi.org/simple/absl-py/: when creating condas environment from file

I am trying to create an anacondas environment from a yml file I have, I have installed anacondas, have added C:\ProgramData\Anaconda3 C:\ProgramData\Anaconda3

Unexpected behavior in tf.data.Dataset map function

I am working on a problem where I need to apply some transformation to my dataset using the map function that tf.data.Dataset provides. The idea is to apply thi

Rotate image with python-barcode ImageWriter in bytesIO stream

I want to rotate the image I have saved in bytesIO with python-barcode ImageWriter but its optional fields do not have this option img = barcode.get_barcode(bar

How can I install pyaudio on a mac with M1 chip? (Have tried homebrew and portaudio already)

I am trying to install pyaudio on my Mac, but I keep getting an error. I have tried using homebrew, then installing portaudio, but still, get the same error. I

How to create a comparison plot from an Excel file with many worksheets

I want to create a plot that will have in the x axis the months and for each country it will show the Orders per month. Attempting to create a function that rea

i get always a 0 as a returned value, can anyone help me to extract that value and use it for further calculations ,and thanks

this is the code , i get always a 0 as a returned value, can anyone help me to extract that value and use it for further calculations , i'm new in python espess

Python: Compare values of two fields with multiple strings and add all unique values to a 3rd field

I am still a Python-Rookie and are stuck with an idea. I want to compare the values of Type1 with Type2 and add all unique values to a 3rd field. My demo data:

There is a data base that stores the image path. Is there a way to implement that path?

@member.route("/createreport") def Createreport(): if "username" not in session: return render_template('login.html',headername="Login เ#

How to kill a subprocess when it goes interactive in Python

I need to run several subprocess.run in a loop. Most of the time, if the exe called in the subprocess succeed nothing happen. But in some cases, usually when so