Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 7 m…
Tag: python
How do you run a function to compare two date by month?
I’m trying to run a function to compare today’s month with the month input by a user. The dates will be input by the user as ‘YYYY-MM-DD’. This is what I have so far: But get the following error: fromisoformat: argument must be str So I tried using the following function instead with s…
Python re.findall regex and text processing
I’m looking to find and modify some sql syntax around the convert function. I want basically any convert(A,B) or CONVERT(A,B) in all my files to be selected and converted to B::A. So far I tried selecting them with re.findall(r”bconvertb(.*?,.*)”, l, re.IGNORECASE) But it’s only return…
Pandas – Count repeating values by condition
Dataframe: I have columns “group” and “val” and I don’t know how to write pandas code to get column “count”? The logic is like this, it should count the number of consecutive values that are on the same side (either positive or negative) grouped by column “group…
Does mongo db ListField maintain ordering?
If I add items to a ListField on a mongo db document in a specific order and then write it to the database, is it guaranteed that all subsequent reads will see the list in the same order? e.g. write read this is using python mongoengine ORM v0.4.2 Answer Yes they do, the driver is faithful to the underlying d…
Websocket Json Data to DataFrame
I am learning how to work with APIs and web sockets in finance. My goal for this code is to access data and create a DataFrame with only columns (index, ask, bid & quote) I have tried appending values to the DataFrame but it creates a new DataFrame every time I receive a message similar to the df = new_df…
How to compare each value of column B with the value of column A?
Compare each value in B column with the first value in A column until it is greater than it, then set the expected column to true. Then compare the value of A column with the expected column that is true until B column value is greater than it,then set the expected column to true. Input: Expected Output Answe…
Returning value from ListWidget Selection in another class – PyQt5
I’m working on a script where when a user clicks on a button, a pop-up window will appear that contains a list. When the user doubleclicks on an item from that list, a label will populate on the original window with the selection. I’ve got most of the code working, but I’m having trouble on …
Django Error: ValueError: Field ‘id’ expected a number but got ‘Нет’
I was adding a new model, but had the error ValueError: Field ‘id’ expected a number but got ‘Нет’. After that I deleted a new model, but error don’t disappear. I tried to change models.py, admin.py, form.py and I even deleted fully models.py, but it didn’t change anything.…
Seach txt File for a keyword like [word & random number]
I have this code: I want to search Text.txt for a keyword that contains a random number, that looks like this: Keyword = [Word & random Number] or [ABC-1] / [ABC-1234] The “Word” part is always the same but the number is up to 4 decimals (1-9999). When the keyword is found, i want to highlight…