so I am trying to log into this website called ttrockstars, and I have written a function to login to the website. However the code seems to be running too fast and ignoring time.sleep(5) that i have added to the code: When I run this, it simply enters the school name and then deletes it and enters the userna…
Python uniform random number generation to a triangle shape
I have three data points which I performed a linear fit and obtained the 1 sigma uncertainty lines. Now I would like to generate 100k data point uniformly distributed between the 1 sigma error bars (the big triangle on the left side) but I do not have any idea how am I able to do that. Here is my code
openpyxl delete all values except the column row excel
I have an excel: So, long is in cell(A1), 5.11 is in cell(B2); I want to clear all the values in suggested_long and suggested_short but need to keep the column name rows as I need to insert data after cleaning all the values. Then the result should be: I know openpyxl can do like: to delete the value in the
Delete sql table rows from python
I can successfully connect my python notebook with sql server this way : Let’s take this sample dataframe : I have a sql table with the same columns, named table_name. Objective : I want to delete in table_name all the rows where a row in df has the same Name, same Date, same Status, and Max = 0 (only i…
Sort a list according to the ascending sort of the second list in python
I have two unsorted lists, x and y, as follows: I would like to sort list y two times, one in ascending order and then in descending order. But, in each sorting of y, I need to sort also the corresponding elements of the list x accordingly. Both lists have the same length of items. I tried with the following
detect a table part from entire image in python
I have an image of size 3500×5000, now I want to detect only the table part from the entire image and crop and rotate it if it is not straight for OCR processing. After all search, I get an idea for cropping each cell in an image using https://medium.com/coinmonks/a-box-detection-algorithm-for-any-image-…
Pandas – expending several values to new columns with some column name manipulation
I’m new to pandas. Consider you have a state in which you have a pandas Dataframe structure of columns like below: user_id | timestamp | foo_name1 | foo_name2 | foo_name3 As we can see Dataframe has several metadata parameters, having raw string values: user_id, timestamp and several dynamic name column…
Rules for determining the order of keyboard events? (Python)
I currently have a situation like this: Through trial I’ve found that the on_press_key() events always happen first (and the logic of my program is dependent on it) but I have no idea why, or if it’s a hardware- or OS- specific thing that could be inconsistent and break if used on other systems (?…
invalid xpath in scrapy (python)
hello i’m trying to build a crawler using scrapy my crawler code is : but when i run the command : scrapy crawl shopspider -o info.csv to see the output i can find just the informations about the first product not all the products in this page. so i remove the numbers between [ ] in the xpath for exempl…
How can I drop duplicates in pandas without dropping NaN values
I have a dataframe which I query and I want to get only unique values out of a certain column. I tried to do that executing this code: db_specification is just a list containing two columns that I query. Some of the values are NaN and I don’t want to consider them duplicates of each other, how can I ach…