Questions tagged [data-manipulation]
Data manipulation is the process of altering data from a less useful state to a more useful state.
data-manipulation
3,924
questions
0
votes
0
answers
26
views
Turn the Year columns into a one column with the years a feature using Pandas [duplicate]
I have a file with the area burned due to wildfires by month (rows) and Years as columns. The numbers in the dataset represent the area burned in hectares.
It looks like this:
How I can convert the ...
0
votes
1
answer
30
views
A way to concat data from child rows of parent row of a pivot table
I have a large pivot table with the following data. The bold text is the parent row of data and the following years (non-bold data) are the child data of the parent row. Is it possible in excel or ...
0
votes
1
answer
23
views
Transforming value into row number
I am conducting some survival analysis and an attempting to turn my wide table into long format for analysis using dplyR. I want to turn the value of 'dead flies' into rows with a binary status for ...
1
vote
0
answers
27
views
Create subset and calculate sums in Python based on a condition
I am currently doing some data manipulation procedures and have run into a problem of how to make subsets based on special conditions.
My example (dataframe) is like this:
Name ID Debt ...
0
votes
1
answer
17
views
Conditionally changing elements of a numpy array using for loop
I have a two dimensional numpy array, and I'm wanting to change all of the 'male' values to 0 and all of the 'female' values to 1.
If I try to assign arr2D[row,element] to a specific value,
I get an ...
0
votes
2
answers
62
views
r difference in each observation within Id
Assuming I have a dataset like this
id time cd4 sequence
1 -0.741958 548 1
1 -0.246407 893 2
1 0.243669 657 3
2 -2.7296369 464 1
2 -2.2505131 845 2
2 -0....
0
votes
1
answer
39
views
How to compute sens slope with yearly data frame with value lower than 3?
I have several Tiff files since 1984. For each year and for each pixel of the area I calculated NDVI, NBR and TCW and the mean of each value per year, but now when I try to do this
library(modifiedmk)
...
0
votes
0
answers
6
views
Transforming a table
I have a problem with a table format and would like to transform it, with bash, R or Python.
This is what I have :
Obs1
Name X
Age 99
Obs2
Name X1
Age 99
What I want :
Column A
Name
Age
...
1
vote
1
answer
31
views
Power Query document not saving changes
I will preface this with I am brand new to Excel Power Query, just learned about it last night and made my source folder containing the csv files to merge (5 total - 2020, 2021, 2022, 2023,2024 (...
0
votes
1
answer
22
views
R: How to combine several nested dataframes
considre this MWE:
library(magrittr)
data <- tibble::tibble(
company = c(
"Google",
"Apple"
)
) %>%
dplyr::mutate(patents = purrr::map(
.x = company,
....
0
votes
1
answer
66
views
Pandas idxmin equivalent for mean
I am trying to filter a very large dataframe that looks like this:
unique id
x
y
1
1
2
1
2
3
1
3
4
2
1
2
2
2
3
2
3
4
to only contain the mean values for each unique id, (e.g. filtered on 'x') ...
4
votes
3
answers
81
views
How to extract birth and death year from string in R?
I have the first paragraph of Wikipedia articles from the wikifacts package (only for people). I like to extract birth year and year of death.
library(wikifacts)
library(tidyverse)
politicians <- ...
0
votes
1
answer
38
views
Detect text block between two tags
I have a file structured like this
$$ some text $$
and I would like to make my script reveal when there is a block of text present within the "$$" tags. This script works well when the text ...
2
votes
3
answers
55
views
Weird behaviour in Lua string.gmatch
I would need to extract everything that comes before and everything that comes after the "\\scalebox" string. I tried with
local example = "sometext\\scalebox{0.74}"
for i in ...
-1
votes
1
answer
56
views
How to manipulate data from an Elementor Pro form and save it in a hidden field?
everything good? I have a WordPress site with Elementor Pro installed and I have been trying unsuccessfully to manipulate the data of a form and save the result of this manipulation in a hidden field ...