multiple-columns

R subsetting a data frame into multiple data frames based on multiple column values

时光总嘲笑我的痴心妄想 提交于 2019-11-27 14:35:34
问题 I am trying to subset a data frame, where I get multiple data frames based on multiple column values. Here is my example >df v1 v2 v3 v4 v5 A Z 1 10 12 D Y 10 12 8 E X 2 12 15 A Z 1 10 12 E X 2 14 16 The expected output is something like this where I am splitting this data frame into multiple data frames based on column v1 and v2 >df1 v3 v4 v5 1 10 12 1 10 12 >df2 v3 v4 v5 10 12 8 >df3 v3 v4 v5 2 12 15 2 14 16 I have written a code which is working right now but don't think that's the best

Splitting multiple columns into rows in pandas dataframe

喜你入骨 提交于 2019-11-27 14:12:28
I have a pandas dataframe as follows: ticker account value date aa assets 100,200 20121231, 20131231 bb liabilities 50, 150 20141231, 20131231 I would like to split df['value'] and df['date'] so that the dataframe looks like this: ticker account value date aa assets 100 20121231 aa assets 200 20131231 bb liabilities 50 20141231 bb liabilities 150 20131231 Would greatly appreciate any help. You can first split columns, create Series by stack and remove whitespaces by strip : s1 = df.value.str.split(',', expand=True).stack().str.strip().reset_index(level=1, drop=True) s2 = df.date.str.split(',',

Multi-Column ComboBox Controls for Winforms [closed]

只谈情不闲聊 提交于 2019-11-27 13:08:38
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . Please recommend some Multi-Column ComboBox control for Winforms application in .net. Better if they are free. I found Syncfusion - Multi-column-combo-box it can show datagrid which is bound to datasource but it is not free. EDIT: There is an awesome control used in inFlow Inventroy, please also tell if you know

Half columns in Twitter Bootstrap 3

谁说我不能喝 提交于 2019-11-27 10:04:11
问题 I couldn't figure out how to make the bootstrap column like this: col 3 | col 4.5 | col 4.5 回答1: You can try this : Just split a col-9 in 2 parts. Bootply : http://www.bootply.com/128927 HTML : <div class="col-xs-3"> col-xs-3 </div> <div class="col-xs-9"> <div class="row"> <div class="col-xs-6">col-xs-4.5</div> <div class="col-xs-6">col-xs-4.5 </div> </div> </div> 来源: https://stackoverflow.com/questions/22986664/half-columns-in-twitter-bootstrap-3

Is it possible to target CSS3 columns individually with selectors?

梦想的初衷 提交于 2019-11-27 07:43:54
问题 The design I am working to has different backgrounds for alternate columns. Is it possible to set up different tiling backgrounds for each column, e.g. column:nth-child(n+1) {background:url(tile1.gif) repeat-x; } Or do I have to fall back on a huge background image that tiles every two columns? 回答1: Unfortunately you cannot change the color of the columns: It is not possible to set properties/values on column boxes. For example, the background of a certain column box cannot be set and a

Apply a function to a subset of data.table columns, by column-indices instead of name

南楼画角 提交于 2019-11-27 06:41:09
I'm trying to apply a function to a group of columns in a large data.table without referring to each one individually. a <- data.table( a=as.character(rnorm(5)), b=as.character(rnorm(5)), c=as.character(rnorm(5)), d=as.character(rnorm(5)) ) b <- c('a','b','c','d') with the MWE above, this: a[,b=as.numeric(b),with=F] works, but this: a[,b[2:3]:=data.table(as.numeric(b[2:3])),with=F] doesn't work. What is the correct way to apply the as.numeric function to just columns 2 and 3 of a without referring to them individually. (In the actual data set there are tens of columns so it would be

SQL: Count distinct values from one column based on multiple criteria in other columns

无人久伴 提交于 2019-11-27 06:13:32
问题 I am trying to do count distinct values based on multiple criteria. Sample data exercise included below. Table1 ╔════════╦════════╦══════╗ ║ Bug ID ║ Status ║ Test ║ ╠════════╬════════╬══════╣ ║ 1 ║ Open ║ w ║ ║ 2 ║ Closed ║ w ║ ║ 3 ║ Open ║ w ║ ║ 4 ║ Open ║ x ║ ║ 4 ║ Open ║ x ║ ║ 5 ║ Closed ║ x ║ ║ 5 ║ Closed ║ x ║ ║ 5 ║ Closed ║ y ║ ║ 6 ║ Open ║ z ║ ║ 6 ║ Open ║ z ║ ║ 6 ║ Open ║ z ║ ║ 7 ║ Closed ║ z ║ ║ 8 ║ Closed ║ z ║ ╚════════╩════════╩══════╝ Desired Query Results ╔══════╦═══════════╦══

How to print third column to last column?

雨燕双飞 提交于 2019-11-27 06:03:31
I'm trying to remove the first two columns (of which I'm not interested in) from a DbgView log file. I can't seem to find an example that prints from column 3 onwards until the end of the line. Note that each line has variable number of columns. Marcin ...or a simpler solution: cut -f 3- INPUTFILE just add the correct delimiter (-d) and you got the same effect. awk '{for(i=3;i<=NF;++i)print $i}' awk '{ print substr($0, index($0,$3)) }' solution found here: http://www.linuxquestions.org/questions/linux-newbie-8/awk-print-field-to-end-and-character-count-179078/ Dennis Williamson Jonathan

After rename column get keyerror

早过忘川 提交于 2019-11-27 05:25:12
I have df : df = pd.DataFrame({'a':[7,8,9], 'b':[1,3,5], 'c':[5,3,6]}) print (df) a b c 0 7 1 5 1 8 3 3 2 9 5 6 Then rename first value by this : df.columns.values[0] = 'f' All seems very nice: print (df) f b c 0 7 1 5 1 8 3 3 2 9 5 6 print (df.columns) Index(['f', 'b', 'c'], dtype='object') print (df.columns.values) ['f' 'b' 'c'] If select b it works nice: print (df['b']) 0 1 1 3 2 5 Name: b, dtype: int64 But if select a it return column f : print (df['a']) 0 7 1 8 2 9 Name: f, dtype: int64 And if select f get keyerror. print (df['f']) #KeyError: 'f' print (df.info()) #KeyError: 'f' What is

ddply + summarize for repeating same statistical function across large number of columns

霸气de小男生 提交于 2019-11-27 05:04:07
问题 Ok, second R question in quick succession. My data: Timestamp St_01 St_02 ... 1 2008-02-08 00:00:00 26.020 25.840 ... 2 2008-02-08 00:10:00 25.985 25.790 ... 3 2008-02-08 00:20:00 25.930 25.765 ... 4 2008-02-08 00:30:00 25.925 25.730 ... 5 2008-02-08 00:40:00 25.975 25.695 ... ... Basically normally I would use a combination of ddply and summarize to calculate ensembles (e.g. mean for every hour across the whole year). In the case above, I would create a category, e.g. hour (e.g. strptime