rows

SQL aggregate function subquery

孤街浪徒 提交于 2019-12-07 14:01:35
问题 What I want to do is count the number of rows returned by a subquery, essentially the following: select pp.prop_id, COUNT((select employee_id from employee e where e.ao1_hours > 0)) from proposal_piece pp group by pp.prop_id order by pp.prop_id Here is my error message: Cannot perform an aggregate function on an expression containing an aggregate or a subquery. Why does this not work? If select is just returning a bunch of employee_id's with a filtering criteria why can't I count the number

radio button multiple rows

落爺英雄遲暮 提交于 2019-12-07 13:30:52
问题 I want to display 6 radio buttons of same radio group. But all the 6 radio buttons remain on same line and goes off the screen. How to display them in two rows (3 radio buttons each)? I tried everything possible for me (I am new to android). 回答1: From searching around, there doesn't appear to be a way of doing it, as RadioGroup uses LinearLayout, which does not wrap. As radio buttons must be direct children to the radio group, you can't add sub-layouts to radio group. This means you will have

r subset rows by criteria and by factor group

强颜欢笑 提交于 2019-12-07 08:57:07
问题 I have this data.frame with a lot of NAs: df <- data.frame(a = rep(letters[1:3], each = 3), b = c(NA, NA, NA, 1, NA, 3, NA, NA, 7)) df > df a b 1 a NA 2 a NA 3 a NA 4 b 1 5 b NA 6 b 3 7 c NA 8 c NA 9 c 7 I would like to subset this dataframe to obtain only factor group rows that have no less than two values, such as this: a b 1 b 1 2 b NA 3 b 3 I have tried this function but it doesn't work: subset(df, sum(!is.na(b)) < 1, by = a) > [1] a b <0 rows> (or 0-length row.names) Any suggestion?

Get <td> values only in specific rows using jQuery

不羁岁月 提交于 2019-12-07 07:43:05
问题 I have a table (id="docsTable") whose rows look similar to this: <tr bgcolor="#E7DDCC"> <td align="center"><input type="checkbox" name="docsToAddToClass[]" value="35" /></td> <td>Document Title</td> <td>Document Description.</td> </tr> I need to iterate through the table, determine which checkboxes the user has checked, and for the rows with a checked checkbox, grab the value for the first and the text for the next two. I don't need to build a collection: Within each iteration I want to

iTextSharp - Use Colspan with PdfPRow

六月ゝ 毕业季﹏ 提交于 2019-12-07 06:43:04
问题 I am able to create multiple rows if they contain the same number of columns: table = new PdfPTable(3); var firstRowCell1 = new PdfPCell( new Phrase ("Row 1 - Column 1")); var firstRowCell2 = new PdfPCell( new Phrase ("Row 2 - Column 2")); var firstRowCell3 = new PdfPCell( new Phrase ("Row 3 - Column 3")); PdfPCell[] row1Cells = { firstRowCell1, firstLineRow2, firstRowCell3 }; var row1 = new PdfPRow(row1Cells); table.Rows.Add(row1); var nextRowCell1 = new PdfPCell( new Phrase ("Row 2 - Column

Splitting single data frame row into multiple rows while performing calculation

寵の児 提交于 2019-12-07 05:28:20
问题 I have a df akin to df1 where I want to break out the rows so that the HOURS column is in intervals of 4, shown in df2. How would I approach this problem and what packages are recommended? IDs can have more than one sequence on a given day. For example, an ID can be listed 2-3 times on a given day, being assigned more than one unit and and more than one CODE. The following are required: All categorical data must remain the same on child rows (e.g., CODE stays the same on every child row) If

Python, Pandas: average every 2 rows together

别等时光非礼了梦想. 提交于 2019-12-07 04:44:14
问题 pretty basic question, but was wondering: What is the 'proper' way to average every 2 rows together in pandas Dataframe, and thus end up with only half the number of rows? Note that this is different than the rolling_mean since it reduces the number of entries. 回答1: A fast way to do it: >>> s = pd.Series(range(10)) >>> s 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 >>> ((s + s.shift(-1)) / 2)[::2] 0 0.5 2 2.5 4 4.5 6 6.5 8 8.5 The "proper way" I guess would be something like: >> a = s.index.values

How can I save a second row of UIPickerView to NSUserDefaults?

本秂侑毒 提交于 2019-12-06 16:35:17
I have pickerView with two rows and I need to save position of both to NSUserDefaults. I have successful saved first row with this code: - (void)pickerView:(UIPickerView *)thePickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { NSInteger selectedRow = [thePickerView selectedRowInComponent:0]; [[NSUserDefaults standardUserDefaults] setInteger:selectedRow forKey:@"picker"]; } And I don't get how to add a second one. With this code I bring back the position: -(void)viewWillAppear: (BOOL) animated { NSUserDefaults *pickerViewSelectionDefaults = [NSUserDefaults

SQL: how to select common lines of one table on several column

久未见 提交于 2019-12-06 11:54:47
问题 I have a table : create table a (page int, pro int) go insert into a select 1, 2 insert into a select 4, 2 insert into a select 5, 2 insert into a select 9, 2 insert into a select 1, 3 insert into a select 2, 3 insert into a select 3, 3 insert into a select 4, 3 insert into a select 9, 3 insert into a select 1, 4 insert into a select 9, 4 insert into a select 12, 4 insert into a select 1, 5 insert into a select 9, 5 insert into a select 12, 5 insert into a select 13, 5 insert into a select 14

Pandas merging rows with the same value and same index

£可爱£侵袭症+ 提交于 2019-12-06 11:40:31
I have a DataFrame with an index called SubjectID and a column Visit . Subjects have multiple Visits and either an integer value or an N/A for Value1 and Value2 . I want to collapse the rows that have the same SubjectID and the same Visit number. Here is my data frame: SubjectID Visit Value1 Value2 B1 1 1.57 N/A B1 1 N/A 1.75 B1 2 N/A 1.56 I want to it to look like this: Subject ID Visit Value1 Value2 B1 1 1.57 1.75 B1 2 N/A 1.56 I was trying to use groupby() to solve this problem but I'm not sure how to make it take into account both the index and the values in the Visit column. You can use