I’m trying to go through a string and every time I come across an asterisk (*) replace it with every letter in the alphabet. Once that is done and another asterisk is hit, do the same again in both positions and so on. if possible saving these permutations to a .txt file or just printing them out. This is what
pytest is not running conftest.py to pick up custom command args
In a project im working on we have a step where we export a csv before exporting we run a regression test step against the report using pytest. pytest is invoked using the following command –sample and –expectations are custom args defined in the conftest.py using the following when calling this code locally it works pytest finds the conf but
How to rename files chronologically without changing their order?
I made an application in Python (link for source code at the bottom) which renames files (in a directory) by sorting them (based on their extension) into one of these: Image, Video, Text, GIF, Audio and Unknown Extension. Basically, it loops through a directory, gets all the files in it, sorts them, for each file in the sorted list it
How to remove an element from a list, referencing it by weakref?
How to remove a list’s element by referencing it by weakref? This returns a ValueError: list.remove(x): x not in list. Answer You need to call the reference object: The original object can be retrieved by calling the reference object if the referent is still alive; if the referent is no longer alive, calling the reference object will cause None to
return index of matching value over columns in dataframe
my input: I trying get over df all range where matching value is true. My code: What I get:* [2, 3, 4, 5] So its correct, but how to get all index over each column in df? In other word, I dont want input manually name of column to get index matching value, but get ouptut per column. So what
how to divide a datetime object by an int
I can’t seem to divide a datetime.time object by an int. Looking at the documentation I can’t figure out why it isn’t working. I get the error: unsupported operand type(s) for /: ‘datetime.time’ and ‘int’. I did see a method that splits the time down into second then performs the division on the number of seconds, but wondering if there
How to get items that are true for ANY() method in Python
Say: How to get the signs it found true in the iteration? Here’s a way Is there a better one liner way of doing it? (Without the for loop maybe) Answer With the few modifications to the any expression, you can get whether each of the signs is in the expression, which signs are in the expression, or just the
Streamlit showing me “Welcome to Streamlit” message when executing it with Docker
I’m trying to run a Docker container created from this Dockerfile Building this container is possible, but when I execute the image, I obtain the following message: And, therefore, I am not able to press enter and continue the execution, as the execution halts. Do you guys know how should I make my Dockerfile to directly execute the streamlit run
Grouping two variables based on third variable bins in python
My intension is to group two variables pairs falling within a third variable’s bin interval. such as: So that I can fetch a XY pair for a particular bin range of third variable, e.g., bin of 25-50 For the same, I tried to sort the “Z” variable and accordingly “X” and “Y” variables, with Z, Y, X = zip(*sorted(zip(Z,Y,X))), that
Combining dummies and count for pandas dataframe
I have a pandas dataframe like this: as a plain text: {‘id;sub_id;value;total_stuff related to id and sub_id’: [‘aaa;1;cat;10’, ‘aaa;1;cat;10’, ‘aaa;1;dog;10’, ‘aaa;2;cat;7’, ‘aaa;2;dog;7’, ‘aaa;3;cat;5’, ‘bbb;1;panda;20’, ‘bbb;1;cat;20’, ‘bbb;2;panda;12’]} The desired output I want is this. Note that there are many different “values” possible, so I would need to automate the creation of dummies variables (nb_animals). But these dummies variables must contain the