repeat

How to melt a dataframe so repeated items become the values that correspond to the index

How to melt a dataframe so repeated items become the values that correspond to the index Question: I have this dataframe: df = pd.DataFrame({‘Status’:[‘CO’,’AD’,’AD’,’AD’,’OT’,’CO’,’OT’,’AD’], ‘Mutation’:[‘H157Y’,’R47H’,’R47H’,’R67H’,’R62H’,’D87N’,’D39E’,’D39E’]}) print(df) Status Mutation 0 CO H157Y 1 AD R47H 2 AD R47H 3 AD R67H 4 OT R62H 5 CO D87N 6 OT D39E 7 AD D39E I want the …

Total answers: 2

Pandas: Create new column with repeating values based on non-repeating values in another column

Pandas: Create new column with repeating values based on non-repeating values in another column Question: I have a dataframe with the following column the follows this format: df = pd.DataFrame(data={ ‘value’: [123, 456, 789, 111, 121, 34523, 4352, 45343, 623] ‘repeatVal’: [‘NaN’, 2, ‘NaN’, ‘NaN’, 3, ‘NaN’, ‘NaN’, ‘NaN’, ‘NaN’], }) I want to create …

Total answers: 2

Streamlit – Cannot repeat emoji string using st.write()

Streamlit – Cannot repeat emoji string using st.write() Question: Summary: Normally to repeat a string in python, you’d use (string * n) where n = number of times to repeat. In Streamlit you have the ability to print emoji using corresponding shortcodes in st.write(). I’ve been able to use st.write(emoji1, emoji2, emoji3) to print emoji …

Total answers: 1

Trying to create a sliding window that checks for repeats in a DNA sequence

Trying to create a sliding window that checks for repeats in a DNA sequence Question: I’m trying to write a bioinformatics code that will check for certain repeats in a given string of nucleotides. The user inputs a certain patter, and the program outputs how many times something is repeated, or even highlights where they …

Total answers: 3

Find all words from a list of letters, including duplicate letters?

Find all words from a list of letters, including duplicate letters? Question: I am trying to write a Python script that more or less mimics the New York Times game Spelling Bee (if you’ve played it). I have a code that prints out all the words from a list of letters, but I want to …

Total answers: 3

How to avoid repetition into list while building dataset

How to avoid repetition into list while building dataset Question: I am trying to create the following dataset: multiple_newbooks = {"Books’Tiltle":["American Tabloid", ‘Libri che mi hanno rovinato la vita ed Altri amori malinconici’, ‘1984’ ], ‘Authors’:[‘James Ellroy’, ‘Daria Bignardi’, ‘George Orwell’], ‘Publisher’: [(‘Mondadori’ for i in range(0,2)), ‘Feltrinelli’], ‘Publishing Year’:[1995, 2022, 1994], ‘Start’: [‘?’, ‘?’, …

Total answers: 1