filling missing values using tidyverse syntax based on conditions within the tibble

Advertisements I’m having difficulty filling missing values in my tibble based on some conditions. I’m trying to fill NA values in the manufacturer column based on the condition field either being YES or NO, I’m only interested in filling NA values for groups where the condition column contains YES. I’m getting the following error which… Read More filling missing values using tidyverse syntax based on conditions within the tibble

Fill two columns in SQL table as a result of an operation done on another (third) column

Advertisements I have a time shift column in my tblCalendar table called TimeShift and need to fill two other columns in the same table, both columns have Null values and their names are StartTime and EndTime. This serves as an example: TimeShift StartTime EndTime 8:00AM – 4:00PM Null Null 10:00AM – 6:00PM Null Null 11:00AM… Read More Fill two columns in SQL table as a result of an operation done on another (third) column

Fill NA in R: imput NA in a column X with values from same ID (column Y ) correspondance

Advertisements I´ve got this dataset (something like below) db <- as.data.frame(cbind(c(1,2,2,3,3,4,4,4,5,5),c(‘a’,’b’,NA,NA,’i’,NA,’d’,NA, NA, NA))) I´d like to fill the V2 NA with same correpondance from ID column V1. At the end I expect this result db <- as.data.frame(cbind(c(1,2,2,3,3,4,4,4,5,5),c(‘a’,’b’,’b’,’i’,’i’,’d’,’d’,’d’, NA, NA))) I´ve tried to make a list with unique ID db_aux <- as.data.frame(cbind(c(1,2,3,4),c(‘a’,’b’,’i’,’d’))) but I guess it´s… Read More Fill NA in R: imput NA in a column X with values from same ID (column Y ) correspondance

Python: Filling a dataframe sequentially based on matching ids (inefficient code)

Advertisements Tables and code at the bottom will probs help much more than description. I have a solution that works but think its very inefficient see bottom. Problem: I have two data frames df_1 and df_2 — these dataframes have a match column – match_id df_2 has a date column that I am trying to… Read More Python: Filling a dataframe sequentially based on matching ids (inefficient code)

Check for duplicate rows for a subset of columns in a Pandas DataFrameGroupBy object

Advertisements Suppose I have a groupby object (grouped on Col1) like below: Col1 Col2 Col3 Col4 Col5 —————————————- AAA 001 456 846 239 row1 002 374 238 904 row2 003 456 846 239 row3 BBB 001 923 222 398 row1 002 923 222 398 row2 003 755 656 949 row3 CCC 001 324 454 565… Read More Check for duplicate rows for a subset of columns in a Pandas DataFrameGroupBy object