Skip to main content
Filter by
Sorted by
Tagged with
1 vote
2 answers
104 views

Why does my function iterate through the rows of a dataframe without a for loop?

I've got a dataframe that looks like this: ImportantNumber ImportantWord LookupVar1 LookupVar2 LookupVar3 100 Mxyztplk 2 3 NA 200 Murgatroyd NA 3 2 300 Veeblefetzer 3 NA NA And I've got a function ...
Luis Morales Knight's user avatar
2 votes
2 answers
78 views

Why does spec() return NULL after subsetting a tibble? (And how do I avoid that?)

After reading in my data using read_csv() from readr, the command spec() returns "full column specification" for the resulting tibble: > spec(steps) cols( duration = col_double(), ...
Ben's user avatar
  • 775
0 votes
0 answers
15 views

Humio Crowdstrike Falcon LogScale Divide subset of a field by total of a field

I am trying to calculate a percentage using Crowdstrike Falcon Logscale, formerly known as Humio. The equation I need to calculate is percent_red_widgets = widgets_redl / widgets_total) * 100. The ...
Shawn Sharp's user avatar
2 votes
1 answer
53 views

Get a row subset of a Pandas Dataframe based on conditions with query

I would like to gain a subset of a Pandas Dataframe based on query, if possible giving several conditions based on column values where only rows have to be selected until conditions appear for the ...
Swawa's user avatar
  • 233
0 votes
1 answer
91 views

pick n different random samples from subgroup

I have two Dataframes that look like this: df = pd.DataFrame({'PERSONALNUMMER': {4756: '0209740',4820: '0234212',4855: '0251297',4750: '0209326',4992: '4000404'}, 'MANDANT': {4756: 'OM', 4820: 'OM', ...
Mike's user avatar
  • 47
0 votes
0 answers
49 views

Execution of complex filtering procedures in PySpark

Currently I'm trying to execute some filtering procedures in PySpark (educational purposes). I'm new to PySpark, so decided to ask for a help. My dataframe look like this: ID ApplicationDate ...
lenpyspanacb's user avatar
13 votes
7 answers
1k views

Find the first row in a data frame that satisfies a condition and delete everything above?

I have a dataframe in R: col1 col2 col3 col4 col5 1 1 a x 10.5 FALSE 2 2 b y 20.3 TRUE 3 3 c z 30.7 FALSE 4 4 apple pie: w 40.1 TRUE 5 5 e v 50.9 apple ...
user430997's user avatar
2 votes
1 answer
52 views

Separating grouped layers in a raster stack in terra

I have a large raster stack that is a bunch of groups stacked together. The only thing differentiating the groups is the layer name, which consistently starts with the same prefix. I'd like to ...
Jaken's user avatar
  • 555
1 vote
1 answer
68 views

Variogram per group

I'm using a variogram to try and detect un-accounted for temporal auto-correlation in my model, but it shows the same pattern for all group levels (fSite). I allowed each fSite to have it's own trend, ...
Nate's user avatar
  • 489
1 vote
2 answers
53 views

Subset data to keep only paired sample ID's within a larger dataset with unpaired samples (contol = 1 row, sample =10+ rows but share a single ID)

enter image description here A text version of what my dataset looks like ID Sample_Type Species 1 Sample A 1 Sample B 1 Sample C 1 Sample D 2 Sample A 2 Sample ...
mbasista's user avatar
-2 votes
2 answers
87 views

Finding a subset of values in another list

Why does this always print false? I expected a different outcome because the first two items in the 4th element in List1 are 61, 64 and those match 2 items in the 1st element of List2 which has 61, 62,...
Tim's user avatar
  • 1
0 votes
1 answer
65 views

time complexity of returning power set (leetcode 78 subsets)

Why the time complexity of generating power set of given array is O(n * 2^n). The solution which I created or even the solution which is shared on leetcode runs 2^n times. 1 loop to generate 1 subset. ...
Onki's user avatar
  • 2,095
1 vote
1 answer
22 views

Use of subsets in conditional statements in GAMS

I have a set lall (location) that includes theoretical node names l1,l2,l4,l6,l11,l13 as defined as followed. lall.csv is just a one column csv file with l1,l2,l4,l6,l11,l13 set lall "all ...
user496181's user avatar
0 votes
3 answers
90 views

Subset dataset based on dates in entire dataset [closed]

I am working with a dataset in R. The dataset has with MANY date variables and I want to subset the data frame based on dates between 2023-01-01 and 2023-12-31. I know I can use the command based on ...
Mads Lumholdt's user avatar
1 vote
2 answers
54 views

Subsetting data changes geom size in ggplot2

I'm trying to plot a subset of my data over the full dataset, like this: As soon as the subset contains more than one row, the size of the subset tiles doesn't match the size of the full dataset ...
quasiquails's user avatar

15 30 50 per page
1
2 3 4 5
460