Questions tagged as 'pandas'

1
answer

Merging two columns into a new column named 'Class' (Pandas dataframe)

df_downsampled[df_downsampled['attack_cat']=="DoS"] Get the entire 'df_downsampled' dataframe where the 'attack_cat' column has the value DoS. Dataset: link colunas = ['srcip','sport','dstip','dsport','proto','state','dur','sbytes', 'db...
asked by 08.10.2018 / 18:28
1
answer

Pandas SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame

I want to copy an element from a dataframe and insert it into another dataframe. In essence there is a dataframe with name x area and another that I need to load with the data of the area, from the comparison of the name in the first datafram...
asked by 18.09.2018 / 03:05
1
answer

(Pandas) - Group and summarize by date

Hello, I am a beginner in pandas and I have a problem that I did not find / understood how to solve in the documentation or other topics. Briefly I need to group the days of my database observations within five days, and for each interval calcul...
asked by 21.08.2018 / 05:34
1
answer

On large scrapes how to avoid ConnectionError?

In Python 3, I have a program to do web-scraping of tables on websites. There are 5,299 pages, on each page there is a table With XHR I found the generated JSON on each page. But always have a connection error after the program scour a few pa...
asked by 13.04.2018 / 12:02
1
answer

Slice proportional to the size of the dataframe

How can I make a slice in the dataframe according to its line size? For example: if the dataframe has 14 rows, split into 2 rows of 7, if you have 28 rows, divide into 3 rows of 7, and so on. Is there any function of the pandas to do this?...
asked by 05.07.2017 / 20:16
1
answer

Compare all rows and columns of two Dfs, update and sum the differences at the end of rows and columns

I have two csv separated by tab. Both have the same number of rows and columns. The first column POS has the same unique values in both dfs. The differences (or not) occur in the values (strings) of columns col1:col4 . I thought...
asked by 08.03.2017 / 14:40
1
answer

Manipulation of columns with pandas

I'm running a regression where I have 3 parameters and a column with categories. As sklearn does not recognize categories I transform them into dummies (I create a column for each category and fill it with 1 case belongs to the column categor...
asked by 19.05.2017 / 03:31
1
answer

How to obtain the size means of a grouping with Pandas?

Given a Pandas #, with data in a structure of this type: import pandas as pd raw_data = { 'tipo': ['a', 'a', 'b', 'c', 'c', 'c', 'd'], 'ano': [2000, 2000, 2000, 2001, 2001, 2001, 2001], } df = pd.DataFrame.from_dict(raw_data)...
asked by 30.04.2014 / 15:07
1
answer

Copy part of the Dataframe where column is Null or NaN

I have the following question. I have the following sample dataframe: import pandas as pd df = pd.DataFrame({'A' : [4,5,13,18], 'B' : [10,np.nan,np.nan,40], 'C' : [np.nan,50,25,np.nan], 'D' : [-30,-50,10,16], 'E' : [-40,-50,7,12]}) Df...
asked by 22.11.2018 / 20:13
1
answer

How to insert a row in a DataFrame Pandas in the middle of other rows?

I have a sensor data output that has the following structure: --- Home --- $ LAGM, Colar03, Yellow, 32262, -31226, -5120, -104,40,190,1662.00,1670.00,236.00, MGAL $ GPGGA, 113203,181,206,6812, S, 05443,4264, W, 1,03,3,4,0,0, M, 4.8, M ,...
asked by 31.07.2018 / 18:28