I’m looking to setup a webdriver in a script as a headless. I’m able to run it as a non headless way but when i’m creating an instance of the Option() it says me missing 1 required positional argument: ‘value’ Here’s a replication of the issue I’m having on the projec…
Tag: python
Not able to import a class from a another package in python
I’m trying to import a class from somename.py into nicename.py. At first I created the the __init__.py file and left it empty. Then I wrote (in nicename.py): and I also tried the command without double points at first. It returns: ModuleNotFoundError: No module named ‘getdir’ Answer Maybe no…
Calling an inner function in Python
I have this final main.py that combines every function I wrote separately, but I can’t make it work, it actually returns the Success at the end but it actually does nothing nor in my local folders or MongoDB. The function is this one: My goal is that, when I call gw2_etl(), it runs every process inside …
Pandas – Create a DF with all the values from 2 columns
I have a DF similar to the below. What I want to do is to take the SKUs from SKU1 and SKU2 and create a separate DF with all possible SKU values. It seems simple but I’m having some trouble. DF SKU1 SKU2 66FS 6dhs b87w ssftv yy5hf y346d Desired Output All_SKUs 66FS b87w yy5hf 6dhs ssftv y346d Answer If
Comparing two data frames with different columns and getting the differences
I have a similar question as here Comparing two data frames and getting the differences But columns in df1 is a subset of columns in df2. I would like to get the difference the two df by comparing those columns in common only. So the result I expect to get is Is there a way to do so? Any help
In pytorch, how to calculate gradient for a element in a tensor when it is used to calculate another element in this tensor?
In this pytorch code: I want y[0]’s gradient to consist 2 parts: loss backward to y[0] itself. y[0] is used to calculate y[1], so it should have the part of y[1]’s gradient. but when I run this code, there is only part 1 in y[0]’s gradient. So how to make y[0]’s gradient to have all 2 …
Can’t figure out error: “UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xdc in position 0: ordinal not in range(128)”
I have a program that is communicating with another machine that sends (or is supposed to send) ASCII characters, the code below is how I write and read code to the machine. def writeCode(send): address = ‘COM4’ I get the error on the “out+=ser.read(1).decode(‘ascii’) line. I loo…
Why does pandas rolling apply throw ValueError when used on axis=1?
Overview I am getting a ValueError when trying to apply a simple function over a dataframe with axis=1 (details below). It looks like it is trying to unpack the output into the columns of the dataframe instead of rows. The problem seems to be related to the apply() specifically, and only occurs when axis=1 is…
ValueError: MAC check failed when using PyCryptodome to decrypt data coming from NiFi
Can someone help me with this problem: I am encrypting a JSON in NiFi with AES_GCM algorithm and using a KDF PBKDF2. The idea is to decrypt this JSON with a python script using PyCryptodome. The following code is an attempt to see if the NiFi encrypted message can be decrypted: I understand that in NiFi with …
SQL optimization to increase batch insert using Scrapy
In my previous post, I asked how I can record items in bulk using scrapy. The topic is here: Buffered items and bulk insert to Mysql using scrapy With the help of @Alexander, I can keep 1000 items in cache. However, my problem here is that the items in the cache are recording one by one while they are being