I’m trying to create a bot that will download videos from this site named “Sdarot” using selenium and python3. Each video (or episode) in the site has a unique page and URL. When you load an episode, you have to wait 30 seconds for the episode to “load”, and only then the <vid…
Calculating a for loop with different indexes simultaneosuly
I have the following for function: This for loop takes a long time to calculate the values for the data frame as it has to loop 50 times for each row (it takes approximately 62 seconds) I tried to use multiprocessor pool from this question. My code looks like this now: I run the function asynchronously with d…
Pyathena is super slow compared to querying from Athena
I run a query from AWS Athena console and takes 10s. The same query run from Sagemaker using PyAthena takes 155s. Is PyAthena slowing it down or is the data transfer from Athena to sagemaker so time consuming? What could I do to speed this up? Answer Just figure out a way of boosting the queries: Before I was…
Checking if list element in list of lists and returning sublist
I have two lists and want to return those sublistst of list2 that contain elements of list1. So far I tried using any: and a naive approach But I only managed to repeat empty list. The result should be Not sure, where I’m going wrong. Is there maybe a way using list comprehensions or mixing list compreh…
pipx-installed Spyder doesn’t recognize Poetry-installed pandas only when trying to view DataFrame in Variable Explorer
I’m using Python 3.8.5. My OS is Kubuntu 18.04. I installed Spyder and Poetry via pipx: Within my project folder, I installed pandas and spyder-kernels as dependencies: I can open Spyder just fine: In Spyder -> Preferences -> Python interpreter, I added the path to the Python interpreter for the p…
How can I convert a list of strings to an array of float numbers?
I’m trying to convert a list of strings to an array of callable float numbers in Python, but I encounter an error. Here is a part of my code: Answer You can use a nested list comprehension for this. The first can iterate through your strings, then for each string you can str.split and convert each eleme…
How to print red heart in python 3
I need to print the red heart emoji ❤️️ with unicode in Python 3 but it has two unicodes (U00002764 and U0000FE0F). How am I suppose to print it? For example, a green heart is print(“U0001F49A”) Answer Whether it “works” depends on the font you have and which glyphs it supports. Here&#…
python-requests: is it possible to bypass HTTPS for speed
Is it possible to bypass the HTTPS on python3+requests to gain speed? Profiling says SSL handling is the slowest part of my script: verify=False just disables the certificate checking, but SSL/TLS still happens in the background. I didn’t find any option to use the dumbest cipher (eg. 0bit) type to gain…
Including Scaling and PCA as parameter of GridSearchCV
I want to run a logistic regression using GridSearchCV, but I want to contrast the performance when Scaling and PCA is used, so I don’t want to use it in all cases. I basically would like to include PCA and Scaling as “parameters” of the GridSearchCV I am aware I can make a pipeline like thi…
Printing variables and strings in Python
I am trying to print the following lines : ‘My name is John Smith.’ ‘My name is John Smith, and I live in CHICAGO’ and I live in chicago’ My code below : How can I get the results from the top? Answer Output: My name is john smith, and I live in chicago. I am 25 years old. By