I am working on some sentence formation like this: I would now need all possible combinations to form this sentence from the dictionary, like: The above use case was relatively simple, and it was done with the following code But can we also make this scale up for longer sentences? Example: This should again p…
Python MWC pattern GUI – Menubar command from controller class
I’m trying to build a tool for data analysis. I expect that this kind of application gets big, so I’m following the MVC pattern to organize it as best as possible. My results are saved in .csv files, so the goal should be to “import” them into the GUI. I want to open these files using …
InvalidArgumentException: invalid argument error using Selenium and Pandas scraping urls reading from a CSV
I was trying to scrape a website, where possible urls are in csv. So after reading it through for loop to call my method, where I would open the url and gonna scrape the contents of the site. But due to some reason I am unable to loop and open the urls Here is my code: Error on console I
How to get the price of a crypto at a given time in the past?
Is there any way I can use ccxt to extract the price of a crypto currency at a given time in the past? Example: get price of BTC on binance at time 2018-01-24 11:20:01 Answer You can use the fetch_ohlcv method on the binance class in CCXT def fetch_ohlcv(self, symbol, timeframe=’1m’, since=None, l…
Python Logging always print message on console without reason
I have a code that work but do things that I don’t understand. This code use logging python module. The problem is that when I run this script there is always (in additional of the normal Stream Log) a line on the console that I don’t want (the second line in STDOUT at the bottom of this post). I …
How to get row number and specify tooltip from another columns in that row?
the problem is that i can’t iterate through whole dataframe and for each cellwidgetitem in specific row in column 1 specify tooltip from another columns in the same row. Above code works and does show whole dataframe in QTableWidget and below code works for extracting text from several columns and setTo…
Pandas: Sort dataframe correctly with German umlauts, upper/lowercase and numbers
I have this dataframe (all strings): I want to sort it so that German umlauts are correct, also lowercase and numbers are correct: Here is my code to generate the dataframe and result: The result is almost correct, but the numbers are sorted in the wrong order, 20 should be before 200: How can I fix the numbe…
asyncio.wait_for does not propagate CancelledError, if waited on future is “done” before cancellation
I’m working on an application that features tasks that can be started by the user. These tasks can also be aborted by the user. The notable thing is, that the cancellation can happen at any given time. I implemented this by using asyncio.tasks.Task which I cancel if the user aborts. I recently updated f…
Indicate a directory on Amazon’s S3
I’m new to AWS services. I’ve always used the code below to calculate NDVI for images that were located in a directory. Now all the necessary images are in an amazon S3 folder. How do I replace the lines below? Answer Amazon S3 is not a filesystem. You will need to use different commands to: List …
Issue in sending python logs to Splunk using splunk_hec_handler
I am using Python logging library to push logs to splunk. This package use HEC method to push logs to splunk. Issue I am facing is that out of many logger statements in my application, I want selectively only few logger statements to splunk not all. So i created one method below method which converts string l…