Questions tagged as 'dataframe'

1
answer

Replace words in a text that are formed, necessarily, formed of letters and numbers

I am trying to replace words in a text that are formed, necessarily, formed of letters and numbers. I've tried this: def passwords(): df['C'] = df['C'].str.replace(r'[a-zA-Z0-9]', '<password>') return df My data:...
asked by 06.12.2018 / 11:54
1
answer

Replace items in a list in a column of a dataframe

I'm trying to replace names that are in a list in a column of a large dataframe. I'm trying this way, but it's not working ... List of names (the list is too large): Jack Liam John Ethan George ... Small dataframe example: A...
asked by 29.10.2018 / 12:05
1
answer

Adding grouped total sum to a new DataFrame pyspark column

I have a dataframe with the following columns: COL1 COL2 COL3 NEW_COL* A asd 1 8 B adf 2 9 A adg 8 1 B adh 9 2 C adj 7 7 D adk 1...
asked by 30.05.2018 / 23:32
1
answer

Python - Transform range of rows into columns [closed]

I have a DataFrame with one column and 5,000 rows. What I need to do is pick up 48-line breaks and transpose to 48 columns with the entire dataFrame How are you? 1. 0.35 2. 0.21 3. 0.45 4. ... 5. 0.12 6. 0.34 As required: [0....
asked by 18.03.2018 / 20:53
1
answer

DataFrame date column

I have this DataFrame and would like to separate the column from the date how do I do this? Data e Hora Consumo(litros) Valor Acumulado 0 2017-08-21 20:00:00 65 65 1 2017-08-21 21:00:00...
asked by 24.06.2018 / 02:21
1
answer

I can not extract data from a specific column

My DataFrame has multiple columns and one of them is not being read when I try to use indexing (eg bar_0617 = media_0617 ['Bar']). The following error appears: KeyError: 'Bar'. I do not know what to do, I already checked the file with my data an...
asked by 16.12.2018 / 03:15
1
answer

Pandas DataFrame.loc () does not find the record

Good morning! I'm trying to manipulate a DataFrame that originates in a DRE (accounting) report. I would like the index to be the account code, which I have already been able to do. However, DataFrame.loc [] does not find the record. Followin...
asked by 25.10.2018 / 16:30
1
answer

DataFrame Handling in R

I have the dataset according to the figure. I need to name the Month column where where 1 is January, 2 February and so on. I also need to group by type of expense and add the amount reimbursed. The idea is to generate monthly charts by name, ty...
asked by 10.09.2018 / 18:11
0
answers

How to store a result in a dataframe?

I run a difference calculation on two columns of data frames that are in a third column. However, if the calculation is executed, the last one will not be stored in the dataframe. def predictions(train): print("cosine_sim") train["cos...
asked by 17.08.2018 / 14:39
0
answers

Raise XLRDError - Indicating name of Python Sheet_name

Good morning. I'm starting with Python and I have a problem. I have N files in Excel and I need to read the sheet_name of each one stating their name, the code I have so far is this: os.chdir("work path") fileLista = glob.glob('*.xls') arqFine...
asked by 21.05.2018 / 16:57