Posts by marin • 165 points
7 posts
-
0
votes1
answer58
viewsQ: Replace words in a text that must be formed of letters and numbers
I am trying to replace words in a text that are formed, obligatorily, formed of letters and numbers. I tried that: def passwords(): df['C'] = df['C'].str.replace(r'[a-zA-Z0-9]', '<password>')…
-
0
votes1
answer978
views -
0
votes1
answer57
viewsQ: Select values from one column from other columns
I am trying to select only column values flightID where Depdelay and Arrdelay are larger than 15. I tried that: delay = data.loc[(data['ArrDelay'] > 15) & (data['DepDelay'] > 15),…
-
1
votes3
answers2247
viewsQ: Typeerror: Object of type 'Nonetype' has no Len()
I’m trying to apply the NMF algorithm to a csv and then extract the phrases linked to each topic import pandas from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.decomposition…
-
0
votes2
answers1557
viewsQ: Making a date set Random with pandas
I’m trying to extract 15O lines from a 500-line dataset. So I’d like to do it on Andom. My data objeto,cor,label cachorro,branco,animal manga,laranja,fruta calça,preta,roupa My script import pandas…
-
1
votes3
answers840
viewsQ: Replace word list in text
I always have a hard time with replace and sub. I know how they work, but with me it’s never right. I have a list of words and am trying to replace these words in a text: Text: Brazil, officially…
-
0
votes1
answer264
viewsQ: REGEX to remove websites, emails
I want to remove website addresses, emails, etc... url_regex = re.compile(r'(?i)(<|\[)?(https?|www)?(.*)?\.(.*){2,4}') mail_regex = re.compile(r'(?i)(<|\[)?@(.*)\.(.*){2,3}') This way I could…