Questions tagged as 'dataframe'

2
answers

Repeating the subtraction of groups in a data frame for all numeric variables

I have the following code: df <- data.frame(grp = rep(letters[1:3], each = 2), index = rep(1:2, times = 3), value = seq(10, 60, length.out = 6), value2 = seq(20, 70, length.o...
asked by 03.12.2018 / 15:55
1
answer

Reading of pdf via R

I need to convert the PDF data below into a data frame: link Doing a search for the How to Read PDF Data in the R . I had some problems installing the package, but I managed to make it work in RStudio after all. But the result was not sati...
asked by 19.03.2018 / 19:24
1
answer

How to remove the rows based on the values of another variable?

Consider the dataframe: data<-data.frame(a=c(1,3,4,5,6,NA,6,NA),b=c(1,NA,NA,4,6,7,NA,1)) I want to delete the entire line when NA exists in variable 'a' . So, what I hope is: data a b 1 1 1 2 3 NA 3 4 NA 4 5 4 5 6 6 6 6 N...
asked by 05.10.2018 / 18:16
2
answers

How to insert missing dates in a data frame?

I have a 30-year time series of data that has fill-in faults. As noted in the example below, some days were not recorded (1961-08-19-1961-08-20,1961-08-21 ...). How do I identify and insert the missing dates in the "date" column, assigning "NA"...
asked by 29.03.2018 / 15:28
1
answer

Divide data frame by the first line of itself

I'm trying to create an index number from a data frame. I would like to divide each column by the first number without having to divide it column by column. Just as an example, df would be: DF1 <- data.frame(Name = c("Aaron", "Blake"), J...
asked by 09.11.2018 / 21:59
1
answer

Filling rows with the correct data in R, joining successive rows

I have a database with the second structure: a=as.data.frame(tribble( ~a, ~texto, ~x2007, ~x2008, "a","aa",0,0, 0,"--",12,13, "b","bb",1,2, "c","cc", 0, 0, 0,"dd", 0,0, 0,"ee",7,8)) Lines beginning with zero are...
asked by 01.09.2018 / 22:28
1
answer

How to group information in a data frame from missing data?

I need to exclude empty df rows from a 30-year time series, with three daily measurements for each variable. I already used the subset(x, ...) function that solves part of the problem. However, in some cases there is no recorded measureme...
asked by 27.03.2018 / 15:14
1
answer

Adding a new data to an empty pandas dataframe

I am creating a code to read several CSV files and extract some parameters and mount a new dataframe with pandas, however I am facing a problem in this construction. Initially, I wanted to create an empty dataframe and as I read the CSVs I wo...
asked by 18.11.2018 / 19:36
2
answers

DataFrame Pandas - Calculate column based on other

I have a dataframe in the following format: colunas = [ 'COMEDY', 'CRIME', 'Classe Prevista' ] precisao_df = pd.DataFrame(columns=colunas) precisao_df['COMEDY'] = y_pred_proba[:,0] precisao_df['CRIME'] = y_pred_proba[:,1] precisao...
asked by 31.10.2018 / 05:31
1
answer

How do I filter data by date in a dataframe (Python)

Being that you would have to create a new dataframe with the information coming from those dates below. import pandas as pd import numpy as np import datetime %matplotlib inline races = pd.read_csv('races.csv') results = pd.read_csv('results.c...
asked by 20.04.2018 / 10:11