How to get the number of requests in queue in python scrapy?
In below code,len(self.crawler.engine.slot.scheduler) is always returning 0and self.crawler.engine.slot.scheduler.stats._stats['scheduler/enqueued'] is returning value in increasing order: 1, 2, 3, 4,...
View ArticleEnvironment variables for the current user with Python
How can you get a list of the environment variables for the current user ("user variables") using Python? os.environ() returns the system variables, and changing those requires admin access. I want to...
View ArticleEnd/Quitting a function right after it calls another function
a beginner learning pythonSo, suppose I have 2 functions, A n BA(): calls B()B(): usual procedures, #has return values; But when a condition is met:`B calls A();# I want function B() to stop/quit and...
View ArticleFind intersections in all dataset rows
I need to write a function.It takes any value from the dataset as input and should look for an intersection in all rows.For example:phone = 87778885566The table is represented by the following...
View ArticleWhile finding subsets of given array through recursion, my code is returning...
I have to return the subsets of the given array, I know the logic that while recurring we have to first include elements than backtrack and then exclude elements of the given array. But while...
View ArticlePython arithmetic function with recursion
This might be done with a rolling function in pandas probably, not sure but I would like to apply the following function for a list, the current state S in position x is defined asS[x] = if S[x-1] >...
View ArticlePython & Pandas: display all rows without omitting
I want to take a look at the data, but when I dopd_data.sort('imdb_rating',ascending=False), or pd_data.sort('imdb_rating',ascending=False).head(100), the data in the middle would get left out. How can...
View ArticleHow can i write for&if-else statement using only one line?
Make List a String: Let's make the list ["Life", "is", "too", "short"] into a "Life is too short" string and print it out.First, Let me tell you i know the way to solve the problem using join()...
View ArticlePython ReGex Pattern Finder
I am trying to get better with ReGex in Python, and I am trying to figure out how I would isolate a specific substring in some text. I have some text, and that text could look like any of the...
View ArticleRaw string producting syntax error : unterminated string literal
def topcarmodel(df): df = df[df['units sold_per annum'] >= 1000] df['price'] = df['price'].str.replace(r'[^0-9.]', '') df['price'] = pd.to_numeric(df['price']) df['commission'] = df['price'] *...
View ArticleHow can I set multiple print area with openpyxl
I have an Excel file which includes one Excel sheet. in the sheet, there are multiple different sections that I want to add to the print area. But in openpyxl I find that I can set only one print area....
View ArticleCannot Get another message in Socket Server
When I try To send an message to the server there ıs no problem after 1 message but when ı try to send another it failingbeacuse of that my app is buggy and i dont want that no one wants...
View Articleweb scraping with python (hackernews)
the codei want to scrape titles, title hyperlinks and score of the feeds of hackernews. When i run the above code , titles and scores are being shown but not the hyperlinks. What can be the fix for...
View ArticleSingle Round Robin Schedule for Odd number of teams with no back-to-back...
Single round robin schedule works best for me for even number of teams keeping that both teams played today, neither of them will play next day (at least one day rest).But for odd number of teams the 1...
View ArticleGet the data in the Span class of HTML by Python
I am trying to get the data in one of span class from a website. Currently, I caught the correct position of my data but I can't get the text of class.My code:import requestsfrom bs4 import...
View Articlelargestinteriorrectangle Package Not Recognized Despite Being Installed [closed]
I installed the largestinteriorrectangle package to use to find the largest inscribed rectangle in a panoramic image after stitching 2 images together.However, when I try to load it in my code, I get...
View ArticlePass object argument through FastAPI
I have question about FastAPI, because I can't understand some stuff, and documentation is not clear for me.I have example program:import jsonimport argparsedef args(): parser =...
View Article"error": "415 Unsupported Media Type: Did not attempt to load JSON data...
I am working on a React-Python(Flask) project. I keep getting the error in the backend:'415 Unsupported Media Type: Did not attempt to load JSON data because the request Content-Type was not...
View ArticleNumpy index argsorted with integer array while retaining sorting order
I have an array x and the result of argsorting it i. I need to sort x (and y, irrelevant here) according to i hundreds of times. It is therefore not doable to sort the data twice, everything needs to...
View Articlehorizontal and vertial lines in plotly express graph using...
I am havin trouble with an error (or something) in my plotly graph.I want to display time series data with horizontal and vertical lines only. My problem is that this works for some data sets and not...
View Article