multiple-columns

pandas filter by two columns (python)

纵然是瞬间 提交于 2019-12-11 09:49:59
问题 I have a pandas DataFrame (df) with many columns, two of which are "Year" and "col_1" I also have a extraction criteria summarised in a list(Criteria): [1234,5432,...,54353,654,1234]. I would like to extract the subset of this DataFrame if the following criteria are met: ((df.Year==1990) & (df.col_1>=Criteria[0])) or ((df.Year==1991) & (df.col_1>=Criteria[1])) or ((df.Year==1992) & (df.col_1>=Criteria[2])) or ... ((df.Year==2010) & (df.col_1>=Criteria[20])) or ((df.Year==2011) & (df.col_1>

Hide column in listview android

我的未来我决定 提交于 2019-12-11 09:48:13
问题 I had about 20 columns input into listview. But I want that user will have an option to disable (hide) some columns in view. I found that I can make my own Array Adapter and view for row. But I don't want to define this for 2 to 20 items in row. Is there any option how to do it? 回答1: I found one way how to do it. For example I have this layout of item in listview. I will made my own adapter and then simply by calling setVisibility(View.GONE); i will hide this item from listview. PS: Here is

Python : How do i get a new column for every file I read?

蓝咒 提交于 2019-12-11 09:07:42
问题 Im trying to read 3 text files and combine them into a single output file. so far so good, the only problem is that I need to create columns for every file i read. right now I have all the extracted data from the files in a single column. #!/usr/bin/env python import sys usage = 'Usage: %s infile' % sys.argv[0] i=3 #start position outfile = open('outfil.txt','w') while i<len(sys.argv): try: infilename = sys.argv[i] ifile = open(infilename, 'r') outfile.write(infilename+'\n') for line in ifile

Populate Multiple combobox's makes VBA userform slow

浪尽此生 提交于 2019-12-11 06:53:37
问题 At the moment I'm working with making a userform with 40 combobox's all which have the same list. My problem is filling all those combobox's is making the userform.show slow. The list that gets populated in those combobox's is a very long list (46542 rows and list length can vary) the list is with 3 columns. I have been fooling around with CONCATENATE the whole list but that doesn't make much of a change. Also because I need to have the value when selected in the combobox to be CONCATENATE

Mean of Multiple Columns in R

本秂侑毒 提交于 2019-12-11 06:37:58
问题 I am trying take the mean of a list of columns in R and am running into a issue. Let's say I have: A B C D 1 2 3 4 5 6 7 8 9 10 11 12 What I am trying to do is take the mean of columns c(A,C) and save it as a value say (E) as well as the mean of columns c(B,D) and have it save as a different value say F. Is that possible? E F 2 3 6 7 10 11 回答1: Check out dplyr: library(dplyr) df <- df %>% mutate(E=(A+C)/2, F=(B+D)/2) df A B C D E F 1 1 2 3 4 2 3 2 5 6 7 8 6 7 3 9 10 11 12 10 11 回答2: We can

Python_How to write data in new columns for every file read by numpy?

江枫思渺然 提交于 2019-12-11 06:26:14
问题 I have several text files with such a construction. Same number of columns but different rows: 1.txt 2013-08-29T15:11:18.55912 0.019494552 0.110042184 0.164076427 0.587849877 2013-08-29T15:11:18.65912 0.036270974 0.097213155 0.122628797 0.556928624 2013-08-29T15:11:18.75912 0.055350041 0.104121094 0.121641949 0.593113069 2013-08-29T15:11:18.85912 0.057159263 0.107410588 0.198122695 0.591797271 2013-08-29T15:11:18.95912 0.05288292 0.102476346 0.172958062 0.591139372 2013-08-29T15:11:19.05912 0

MySQL SELECT id of row where GREATEST of MAX entries of several columns

£可爱£侵袭症+ 提交于 2019-12-11 06:16:11
问题 I have this table mytable: +----+--------------------------------------+ | id | date1 | date2 | date3 | +----+--------------------------------------+ | 1 | 2014-01-08 | NULL | NULL | | 2 | 2014-05-09 | NULL | NULL | | 3 | 2014-06-13 | NULL | NULL | | 4 | NULL | 2014-03-24 | NULL | | 2 | NULL | NULL | 2014-08-15 | | 4 | 2014-01-01 | NULL | NULL | | 1 | 2014-02-15 | NULL | NULL | | 3 | NULL | 2014-12-06 | 2014-10-12 | | 4 | 2014-08-06 | NULL | NULL | | 2 | 2014-05-22 | NULL | NULL | +----+-----

Warning numerical expression has >1 elements: only the first used

爷,独闯天下 提交于 2019-12-11 06:08:05
问题 I have a dataset as follows: Apr May Jun Jul Aug Sep Oct Nov b 1.0 9.0 4.0 5.3 6.4 3.4 2.5 4.3 2 5.0 6.0 9.0 2.3 5.8 2.3 6.5 5.2 3 8.0 4.0 6.0 0.7 5.2 1.2 2.2 6.1 4 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 7 3.2 3.2 3.2 3.2 3.2 3.2 3.2 3.2 8 4.4 4.1 5.1 6.1 7.1 8.1 9.1 6.8 6 5.6 5.0 3.2 4.2 5.2 1.2 2.2 3.2 5 6.8 5.9 8.9 2.3 3.3 5.7 4.7 3.7 5 8.0 6.8 9.8 4.8 5.8 6.8 7.8 8.8 5 9.2 7.7 7.7 2.8 3.8 4.8 5.8 6.8 6 I want to add a column sum data$sum=rowSums(data[data$b:8]) . But getting a warning `numerical

BindingSource.Find Multiple Columns

浪子不回头ぞ 提交于 2019-12-11 05:34:49
问题 Is it possible to use the Find method of a BindingSource on multiple columns? For example, say I have a gridview displaying current pets; two comboboxes, cboPetType and cboGender; and a button to create a new record into the Pet table based on the values of these two comboboxes. Now, let's say I only want one of each PetType/Gender combination (Dog - M, Cat - F, etc.). So, if I have a Dog - M pet in my BindingSource and a user selects Dog and M from the comboboxes, I would like to stop the

Extracting column range from text file via bash tool

本秂侑毒 提交于 2019-12-11 05:25:55
问题 Assume a text file ( file1 ) that contains multiple lines of alphabetic strings, each preceded by a short alphanumeric string that acts as a barcode. The alphabetic strings are all identic in length, the preceding alphanumeric ones are not. Alphabetic and alphanumeric strings are separated by a whitespace in each line. $ cat file1 a1 abcdefghijklmnopqrstuvwxyz b27 abcdefghijklmnopqrstuvwxyz c4 abcdefghijklmnopqrstuvwxyz Assume a second file ( file2 ) that contains information on a column