transpose

Transpose a single column to multiple rows

瘦欲@ 提交于 2021-02-05 12:18:40
问题 I have one column of data with approximately 800 records. Each 18 cells is one record. I need a script that takes every 18 cells and transposes them to a row dynamically, or even a way to write excel formula to transpose every 18 records from the column to a row. 回答1: You'll probably get asked "what have you tried" since it's preferred that you have a bash at it and ask when you get stuck rather than asking for a complete solution. That having been said, I can offer you some tips to get you

Transpose / reshape dataframe without “timevar” from long to wide format

早过忘川 提交于 2021-02-05 09:29:21
问题 I have a data frame that follows the below long Pattern: Name MedName Name1 atenolol 25mg Name1 aspirin 81mg Name1 sildenafil 100mg Name2 atenolol 50mg Name2 enalapril 20mg And would like to get below (I do not care if I can get the columns to be named this way, just want the data in this format): Name medication1 medication2 medication3 Name1 atenolol 25mg aspirin 81mg sildenafil 100mg Name2 atenolol 50mg enalapril 20mg NA Through this very site I have become familiarish with the reshape

Transpose / reshape dataframe without “timevar” from long to wide format

我怕爱的太早我们不能终老 提交于 2021-02-05 09:29:20
问题 I have a data frame that follows the below long Pattern: Name MedName Name1 atenolol 25mg Name1 aspirin 81mg Name1 sildenafil 100mg Name2 atenolol 50mg Name2 enalapril 20mg And would like to get below (I do not care if I can get the columns to be named this way, just want the data in this format): Name medication1 medication2 medication3 Name1 atenolol 25mg aspirin 81mg sildenafil 100mg Name2 atenolol 50mg enalapril 20mg NA Through this very site I have become familiarish with the reshape

Comma separated list into matched columns pairings

 ̄綄美尐妖づ 提交于 2021-02-05 07:45:10
问题 I thought I was a decent Sheets jockey, but here's a toughie. I'd like to turn the left into the right using just a formula Sample also at: https://docs.google.com/spreadsheets/d/1JgDZOV_K7SbOrCb27Z5K2XUBcrtq99GTCa3-BM2pOD0 The closest I found was this (Separating Comma List into Cells with Formula) but it doesn't also do the matching. 回答1: alternative by @Matt:King: =ARRAYFORMULA(QUERY(VLOOKUP(SEQUENCE(COUNTA(A2:A)* COLUMNS(SPLIT(B2:B, ",")), 1, 0)/ COLUMNS(SPLIT(B2:B, ","))+2, {ROW(A:A), A

transpose a map collecting keys along the way

走远了吗. 提交于 2021-02-04 15:09:29
问题 I'm trying to transpose a map so that: [x: y, w: y, a: b] becomes [y: [x, w], b: a] (all variables are strings) Doing something like ["x": "y", "w": "y", "a": "b"].collectEntries { [it.value, it.key] } gets me part way, but stomps on the first new value for "y". I only get: [y:w, b:a] What is the best way to slurp up the new values into an array for their common new key? Thanks for any help or suggestions. 回答1: I hope this helps : def map = ["x": "y", "w": "y", "a": "b"] map.groupBy{ it.value

transpose a map collecting keys along the way

两盒软妹~` 提交于 2021-02-04 15:08:44
问题 I'm trying to transpose a map so that: [x: y, w: y, a: b] becomes [y: [x, w], b: a] (all variables are strings) Doing something like ["x": "y", "w": "y", "a": "b"].collectEntries { [it.value, it.key] } gets me part way, but stomps on the first new value for "y". I only get: [y:w, b:a] What is the best way to slurp up the new values into an array for their common new key? Thanks for any help or suggestions. 回答1: I hope this helps : def map = ["x": "y", "w": "y", "a": "b"] map.groupBy{ it.value

Need to transpose the vertical data to horizontal format, but few cells in Vertical format can have more than 2 or 3 sub categories in Excel VBA

喜欢而已 提交于 2021-01-29 19:35:58
问题 This is BEFORE image This is AFTER Image 回答1: It is based on the assumption that your original data is still listed in the column direction. Sub test2() Dim Ws As Worksheet Dim toWs As Worksheet Dim vDB, vR() Dim rngDB As Range Dim i As Long, j As Long, n As Long Dim r As Long, c As Long, k As Long Set Ws = Sheets(1) Set toWs = Sheets(2) Set rngDB = Ws.Range("a1").CurrentRegion vDB = rngDB r = UBound(vDB, 1) c = UBound(vDB, 2) For j = 2 To c n = n + 1 'ReDim Preserve vR(1 To 4, 1 To n) ReDim

Covert wide to long in sas when all the variable has the suffix needed

谁都会走 提交于 2021-01-29 14:41:57
问题 I want the first wide dataset to be as the second long datafile, I have thought about using array, but considering I have 100 variables (the example only have 2), do I need 100 arrays? Could you let me know how to do? 回答1: Use a double transpose. First transpose to a tall structure. Then split the name into the basename and time. Then transpose again. Here is untested code since no example data was provided (only photographs). proc transpose data=have out=tall ; by id; var _numeric_; run;

Hive: Is there a way to get the aggregates of all the numeric columns existing in a table?

走远了吗. 提交于 2021-01-29 14:37:44
问题 I have a table containing over 50 columns (both numeric and char), is there a way to get the overall statistics without specifying each column? As an example: a b c d 1 2 3 4 5 6 7 8 9 10 11 12 Ideally I would have something like: column_name min avg max sum a 1 5 9 15 b 2 6 10 18 c 3 7 11 21 d 4 8 12 24 Nevertheless, getting one aggregate at a time it would be more more than helpful. Any help/idea would be highly appreciated. Thank you, O 回答1: You can parse DESCRIBE TABLE output using AWK

How do I transpose a result set and group by week?

家住魔仙堡 提交于 2021-01-29 09:00:27
问题 I have a view based on query: SELECT CONVERT(VARCHAR(10), date, 103) AS date, eventid, name, time, pts FROM results WHERE DATEPART(yy, date) = 2019; This provides a data set such as this: Date EventID Name Time Points 24/04/2019 10538 Fred Flintstone 22:27 10 24/04/2019 10538 Barney Rubble 22:50 9 24/04/2019 10538 Micky Mouse 23:17 8 24/04/2019 10538 Yogi Bear 23:54 7 24/04/2019 10538 Donald Duck 24:07 6 01/05/2019 10541 Barney Rubble 21:58 10 01/05/2019 10541 Fred Flintstone 22:00 9 01/05