Questions tagged as 'pandas'

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

How to paste a dataframe on a preformatted worksheet in Python?

I have a preformatted template in Excel that way. I would like to paste values from a dataframe into the pandas on these cells, creating a new file formatted with values and holding the original file. How do I do this?     
asked by 16.08.2018 / 19:41
2
answers

Make a random of a dataset with pandas

I'm trying to extract 15O lines from a 500-line dataset. So I would like to do it at random. My Data objeto,cor,label cachorro,branco,animal manga,laranja,fruta calça,preta,roupa My script import pandas import pandas as pd df = pd...
asked by 23.08.2018 / 23:12
1
answer

In pandas, how to merge two dataframes, but only a two-column stretch?

In Python 3 and Pandas I have two dataframes eleitos_d_doadores_d.info() <class 'pandas.core.frame.DataFrame'> Int64Index: 16090 entries, 16 to 26412 Data columns (total 23 columns): uf_x 16090 non-null object p...
asked by 21.02.2018 / 18:03
2
answers

Adding points in a range of known data

I'm working on data analysis using Python and for this I'm training algorithms like SVC and K-means. The data used for the training have a fixed spacing between each sample, since they are sampled by an oscilloscope in fixed periods of time, in...
asked by 19.02.2018 / 20:05
1
answer

Concatenate pandas dataframes with different column names

I have two Pandas DataFrames that I would like to combine into one. They have the same number of columns, in the same order, but have headers with different names. Is there any approach to efficiently combining these dataframes? df1 index Dat...
asked by 31.01.2018 / 17:00
1
answer

Python / Pandas - How to remove extra space between two words in a column of the data frame

The "strip" function removes the spaces on the left and right, but does not remove the spaces between the words: raw_data = {'NAME': [' José Luiz da Silva ']} df = pd.DataFrame(raw_data, columns = ['NAME']) df['NAME'] = df['NAME'].str...
asked by 04.07.2017 / 16:16
1
answer

Python / Pandas - How to compare if column content of the data frame, in date format, is equal to another column of date plus or minus 1 day?

I have a date frame with two columns in the date format and I need to compare if one of them is between the interval of one more day or less than another column. For example: Column A = 2015-03-02 Column B = 2015-03-01 Comparation: If Column A =...
asked by 13.07.2017 / 17:33
1
answer

Change coding in pd.to_datetime

I wanted to know if there is a possibility to change the encoding of an element returned by the to_datetime function of pandas. I need to change to ISO-8859-1 encoding to compare the date with others that are stored in an external file (T...
asked by 22.05.2017 / 19:18
1
answer

XOR operation filtering the values of my list in the DataFrame columns

I have multiple lists and a single dataframe, my goal is to filter my columns containing the same values from my list and create a XOR operation dynamically. When I find my XOR result equal to 0, the line of my result should be deleted. l1 = [...
asked by 15.12.2018 / 18:34