data-manipulation Questions

4

Solved

I have a dataset and I want to perform something like Group By Rollup like we have in SQL for aggregate values. Below is a reproducible example. I know aggregate works really well as explained her...
Noellanoelle asked 23/3, 2016 at 3:6

3

Solved

I have some problems with my result: dataCorr = data.corr(method='pearson') dataCorr = dataCorr[abs(dataCorr) >= 0.7].stack().reset_index() dataCorr = dataCorr[dataCorr.level_0!=dataCorr.level_...
Konyn asked 23/1, 2018 at 6:15

33

Solved

I have a nested data structure containing objects and arrays. How can I extract the information, i.e. access a specific or multiple values (or keys)? For example: var data = { code: 42, items: ...
Barite asked 12/8, 2012 at 13:2

5

I am having issues accessing data inside a dictionary. Sys: Macbook 2012 Python: Python 3.5.1 :: Continuum Analytics, Inc. I am working with a dask.dataframe created from a csv. Edit Ques...
Sophist asked 26/8, 2016 at 15:25

8

Solved

so basically user enters a sequence from an scanner input. 12, 3, 4, etc. It can be of any length long and it has to be integers. I want to convert the string input to an integer array. so int[0] w...
Adkison asked 16/9, 2013 at 23:7

5

I have a dataset similar to this: dataset <- structure( list( Participant.Id = 1:5, x1 = c(10L, 20L, 30L, 40L, 50L), x2 = c(15L, 25L, 35L, 45L, 55L), x3 = c(20L, 25L, NA, 45L, NA), x4 = c(25L,...
Marcellus asked 9/1, 2024 at 9:25

1

I have a nested list called inputs: library(htmltools) library(shiny) inputs = tagList( selectInput('first', 'FIRST', letters), checkboxInput('second', 'SECOND') ) str(inputs, max.level = 1) ...
Tranquil asked 5/10, 2019 at 3:40

3

Solved

Hello I have a dataset of 3-5 rows per group as the following and I want to put some columns in a longer format and have on column in a wider format. The first dataset below represents the original...
Younker asked 20/2, 2021 at 17:4

4

Solved

Though question seems to be duplicate, i'm posting this as non of them gave a solution and relevant to my problem. dtrain<-xgb.DMatrix(data=data.matrix(train),label=data[t,c(31)]) Error in xg...
Postmortem asked 24/11, 2015 at 10:57

5

Solved

I have a list like this: x = list(a = 1:4, b = 3:10, c = NULL) x #$a #[1] 1 2 3 4 # #$b #[1] 3 4 5 6 7 8 9 10 # #$c #NULL and I want to extract all elements that are not null. How can ...
Technic asked 3/6, 2013 at 12:8

7

I have a dataframe (called df) that looks like this: I'm trying to take all weekend 'Volume' values (the ones where column 'WEEKDAY'=5 (saturday) or 6(sunday)) and sum them to the subsequent monda...
Predate asked 22/3, 2022 at 17:1

2

Solved

I am trying to groupby a column and compute value counts on another column. import pandas as pd dftest = pd.DataFrame({'A':[1,1,1,1,1,1,1,1,1,2,2,2,2,2], 'Amt':[20,20,20,30,30,30,30,40, 40,10, 10...
Miracidium asked 29/9, 2016 at 19:41

8

Trying to use awk command to implement this rule: if line doesn't starts with "O|" or "A|" or "S|" I want to remove new line on before line I have this file in input (...
Pregnable asked 19/12, 2022 at 16:30

5

Solved

I have this dataset in R: id = 1:5 col1 = c("12 ABC", "123", "AB", "123344567", "1345677.") col2 = c("gggw", "12", "567&qu...
Cullet asked 18/11, 2022 at 19:27

6

Solved

I have a dataframe 'df' that has categorical and POSIXct columns. The data look like: Category DateTime A 2022-08-29 00:00:00 A 2022-08-29 00:00:00 A 1 2022-08-29 00:00:00 A 1 2022-08...
Rhiamon asked 30/8, 2022 at 15:2

8

Solved

I have 5 vectors of different lengths a <- c(1) #with length of 1 b <- c(4.4,3.5) #length 2 c <- c(5.6,7.8,6.0) #length 3 d <- c(0.8,6.9,8.8,5.8) #length 4 e <- c(1.8,2.5,2.3,6.5,1.1...
Chromatin asked 24/8, 2022 at 13:43

3

Solved

I have a matrix which I want to convert to one with binary output (0 vs 1). The matrix to be converted contains four rows of rankings (1 to 4): mat1.data <- c(4, 3, 3, 3, 3, 2, 2, 1, 1, 1, 3, 4...
Syck asked 16/7, 2022 at 14:3

7

I am working with the R programming language. I have the following data: library(dplyr) my_data = data.frame(id = c(1,1,1,1,2,2,2,3,4,4,5,5,5,5,5), var_1 = sample(c(0,1), 15, replace = TRUE) , var...
Benuecongo asked 6/6, 2022 at 2:15

6

Suppose I have the following lists of factor: factor_1 = c("A1", "A2", "A3") factor_2 = c("B1", "B2") factor_3 = c("C1", "C2", ...
Predial asked 20/4, 2022 at 3:27

3

Solved

I am trying to figure out how to use pivot_longer from tidyr in the following example. This is how the original table called dat_plot is structured like: year organizational_based action_based ide...
Jorum asked 13/1, 2022 at 17:26

3

I came across the following logic problem: In this problem, you are required to match the real names of basketball players to their nicknames, and sort the basketball players by their heights. Nor...
Micrography asked 30/12, 2021 at 6:3

8

Solved

There are many NA's in my dataset and I need to shift all those cells (at row level) to the left. Example- my dataframe: df=data.frame(x=c("l","m",NA,NA,"p"),y=c(NA,"b","c",NA,NA),z=c("u",NA,"w...
Radioelement asked 25/4, 2014 at 5:57

2

Solved

I have the following SQL query I am running in SAS: proc sql; create table my_table as select a.*, b.* from table_a a inner join table_b b on (a.date_1 between b.date_2 and b.date_3 and a.id1 = b....
Jacinto asked 4/12, 2021 at 4:0

2

Solved

I want to combine data frames in long format with different length because of the time variable (imbalanced panel data): set.seed(63) #function to create a data frame that includes id, time and x f...
Catercornered asked 26/11, 2021 at 18:49

1

I am working with the R programming language. Recently, I read about a new decision tree algorithm called "Reinforcement Learning Trees" (RLT) which supposedly has the potential to fit &q...
Shoemaker asked 2/11, 2021 at 2:46

© 2022 - 2025 — McMap. All rights reserved.