Questions tagged [data-wrangling]

1242 questions
0
votes
0 answers

How do I make values in a column their own separate columns with the corresponding values?

So I have the following dataset schema. Type | Quarter | Revenue How do I turn the Quarter column into different column names (such as Q2, Q3) and have the respective revenue values attached to it? I want it to look like this below Type | Q2 Rev |…
0
votes
2 answers

Move rows to be on the same height?

[ The image above shows the first ~20 rows of my df. The goal is to move the b3_01 - b3_10 rows to be on the same height as rows that have a number in the v011 column. For example, caseid #4 is the mom and case ids #5 and 6 are her kids. I want both…
Anna Bokun
  • 55
  • 7
0
votes
3 answers

Data wrangling: How to merge two wide format datasets into one

I have two wide format datasets. Both share a common index column and I would like to combine both datasets into a single wide format dataset based on this common column. A sample of the datasets is provided below. Let dataset A be: Wherein…
Rafael
  • 131
  • 6
0
votes
1 answer

Convert time variable into factor in R

I am working on a transaction data set that reports the time of transaction in hhmmss format. e.g., 204629, 215450 etc. I would like to derive from the given column a factor variable with levels that indicate certain hours of the day e.g. 12-3 pm,…
Nibbles
  • 19
  • 6
0
votes
1 answer

comparing timestamps in two consecutive rows which have different values for column A and the same value for column B in Big Query

guys, I have a big query result which shows me the time (in the column local_time) that riders (in the column rider_id) logout of an app (the column event), so there are two distinct values for the column event, "authentication_complete" and…
0
votes
3 answers

How to use an if loop in a dataframe

Question: Create a new column with a 1 if the country's % Renewable value is at or above the median for all countries in the top 15, and a 0 if the country's % Renewable value is below the median. My Solution: medi = Top15['%…
0
votes
1 answer

How to convert multiple selected column names from integer to date in r

I have a data set with column names that look like this. INPUT Country X1.22.20 X1.23.20 X1.24.20 X1.25.20 X1.26.20 X1.27.20 India 40 20 30 21 25 28 USA 21 22 23 45 32 …
nuke
  • 45
  • 6
0
votes
1 answer

How to map another pandas DataFrame to another one with Python

I have two Pandas DataFrame. I have one data frame containing 3 columns of interests, which contains IDs of customers for different products. I have a second data frame containing the names of the customers. I would like to extend the first data…
JA-pythonista
  • 1,225
  • 1
  • 21
  • 44
0
votes
1 answer

Data wrangling for creating multiple bar graph

So, I have this tibble from which I am trying to make a multiple bar graph that shows how much was spent supporting(for) or opposing(against) each of these candidates However, I am completely lost on how to go about doing it, and I think I want to…
temo
  • 69
  • 5
0
votes
2 answers

Segregate multi-line transactions based on row values

I have a retail transaction data set that looks like: TRANSID GROSS AMNT TRANSROWTYPE 123 50 Z 123 20 A 123 30 A 126 90 Z 126 20 A 126 30 …
Nibbles
  • 19
  • 6
0
votes
1 answer

Combining componenets of a list in r

I have a list that contains data by year. I want to combine these components into a single dataframe, which is matched by row. Example list: List [[1]] State Year X Y 23 1971 etc etc 47 1971 etc etc List[[2]] …
JeffB
  • 139
  • 1
  • 10
0
votes
3 answers

R - Can I use regex to split data from one column into new multiple columns and a binary identifier?

I have a dataset about D&D Characters that looks something like this Race Class Level AC Human Fighter | Wizard 10 15 Elf Wizard 8 10 Human Rogue 6 12 Dwarf Barbarian 15 …
0
votes
1 answer

Find similar rows and subtract a particular column value in Pandas Dataframe

I know there are similar problems and solutions in here, but I dont seem to find the exact solution. Wanted to find rows with "all but one" column similar. So, ColumnA ColumnB ColumnC ColumnD ColumnE 1 John Texas …
0
votes
1 answer

Group Rows By Cumulative Sum

I am working on a problem to group rows by using cumulative sum of an attribute (after being ordered). But I am new to python and don't know how to process it. Please kindly advise. Any help is appreciated. Here is my input, which is a panda…
0
votes
1 answer

How do I modify multiple range of rows for a newly created Column in my dataframe?

I've been having trouble trying to modify multiple range of rows' values for a newly created column in a dataframe and was hoping to get some help. I apologize if this question has been asked before and would really appreciate it if you could point…
Vic
  • 43
  • 1
  • 6