Category "python"

Use diffie hellman key exchange algorithm to encrypt and decrypt files in python

I want to implement an algorithm which will encrypt and decrypt files using diffie hellman algorithm but I am unable to find any solution for the same. Here is

O(log n) algorithm in theory runs much slower in practice

The algorithm is for calculating 2^n recursively. I have used the Master theorem to determine that the time complexity is indeed O(log n) which seems to correct

Problem creating dll and loading then in Python ctypes

I want to learn to create DLLs in c++ and use them in python to increase the speed of calculations. To begin with, I tried to create a simple C++ dll and load

Multiple optional command parameters with discord.py

I was looking at asking for multiple optional parameters with discord.py, although I'm not sure how to do it. This is my example, although I'm pretty sure it's

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