rows

Columns to Rows in MS Access

大憨熊 提交于 2019-12-29 08:59:07
问题 I am trying to create a query in MS Access to ultimately take the output from this: Name Cat 1 Cat 2 Cat 3 Cat 4 Cat 5 Cat 6 Joe 2 12 10 1 0 0 Bob 0 0 0 0 0 0 Jody 2 4 3 1 2 0 Harry 0 4 14 0 2 0 To something like this: Name Joe Bob Jody Harry Cat 1 2 0 2 0 Cat 2 12 0 4 4 Cat 3 10 0 3 14 Is this even possible? EDIT SELECT [Authorizer Name], Sum([Q1A - CD # 1]) AS [Category 1], Sum([Q2A- CD # 2A] + [Q8A- CD # 2A] + [Q10A- CD # 2A] + [CTS A accurate- CD # 2A] + [e-correspondence A accurate- CD #

Summing columns on every nth row of a data frame in R

不羁岁月 提交于 2019-12-29 07:18:06
问题 I have data frame with 12511 rows and 16 columns obtained from animal running experiment. Each row representing running counts every minute for each animal. I would like to sum the columns on every 60th row (that is counts per hour). I tried to use apply function for summing 60 rows: apply(rw[1:60,],2,sum) apply(rw[61:120,],2,sum) apply(rw[121:180,],2,sum) ... keeping to do this until 12511 is unthinkable and time consuming. I am sure there is a smart way to condense my data to 208 rows.

get number of rows with pdo

荒凉一梦 提交于 2019-12-29 06:15:49
问题 I have a simple pdo prepared query: $result = $db->prepare("select id, course from coursescompleted where person=:p"); $result ->bindParam(':p', $q, PDO::PARAM_INT); $result->execute(); $rows = $result->fetch(PDO::FETCH_NUM); echo $rows[0]; the echo seems to be returning the ID value of the record, not the number of records returned by the query? any idea or explanation for this? 回答1: PDO::FETCH_NUM: returns an array indexed by column number as returned in your result set, starting at column

get number of rows with pdo

眉间皱痕 提交于 2019-12-29 06:15:41
问题 I have a simple pdo prepared query: $result = $db->prepare("select id, course from coursescompleted where person=:p"); $result ->bindParam(':p', $q, PDO::PARAM_INT); $result->execute(); $rows = $result->fetch(PDO::FETCH_NUM); echo $rows[0]; the echo seems to be returning the ID value of the record, not the number of records returned by the query? any idea or explanation for this? 回答1: PDO::FETCH_NUM: returns an array indexed by column number as returned in your result set, starting at column

Different (dynamic) items height in GridLayoutManager

99封情书 提交于 2019-12-29 06:13:08
问题 I have a RecyclerView and GridLayoutManager with 2 columns. How can I force LayoutManager to be according with template on the first screenshot? Now I have result as on the 2th screenshot. Need result: Current result: 回答1: GridLayoutManager will use a grid, and you can set some span, but not different heights for different cells. What you want is a StaggeredGridLayoutManager. This will just put the items on the screen if they fit, leading to your needed result. You can also change the

how to transform comma separated column into multiples rows in db2

爱⌒轻易说出口 提交于 2019-12-28 18:43:41
问题 I have the following table (the number of the references is variable): Id | FK_ID| Reference | ----------------------- 1 2100 GI2, GI32 2 2344 GI56 And I need the following result: Id | FK_ID| Reference | ----------------------- 1 2100 GI2 2 2100 GI32 3 2344 GI56 Is there any short way to transform the data like this using DB2? 回答1: You really should not be storing data like this. Fortunately, there is a way to undo the damage with recursive SQL, something along these lines: WITH unpivot (lvl

Collapsing rows in a Pandas dataframe if all rows have only one value in their columns

 ̄綄美尐妖づ 提交于 2019-12-28 06:49:17
问题 I have following DF col1 | col2 | col3 | col4 | col5 | col6 0 - | 15.0 | - | - | - | - 1 - | - | - | - | - | US 2 - | - | - | Large | - | - 3 ABC1 | - | - | - | - | - 4 - | - | 24RA | - | - | - 5 - | - | - | - | 345 | - I want to collapse rows into one as follows output DF: col1 | col2 | col3 | col4 | col5 | col6 0 ABC1 | 15.0 | 24RA | Large | 345 | US I do not want to iterate over columns but want to use pandas to achieve this. 回答1: Option 0 Super Simple pd.concat([pd.Series(df[c].dropna()

For each row in an R dataframe

别等时光非礼了梦想. 提交于 2019-12-27 16:26:56
问题 I have a dataframe, and for each row in that dataframe I have to do some complicated lookups and append some data to a file. The dataFrame contains scientific results for selected wells from 96 well plates used in biological research so I want to do something like: for (well in dataFrame) { wellName <- well$name # string like "H1" plateName <- well$plate # string like "plate67" wellID <- getWellID(wellName, plateName) cat(paste(wellID, well$value1, well$value2, sep=","), file=outputFile) } In

For each row in an R dataframe

て烟熏妆下的殇ゞ 提交于 2019-12-27 16:26:30
问题 I have a dataframe, and for each row in that dataframe I have to do some complicated lookups and append some data to a file. The dataFrame contains scientific results for selected wells from 96 well plates used in biological research so I want to do something like: for (well in dataFrame) { wellName <- well$name # string like "H1" plateName <- well$plate # string like "plate67" wellID <- getWellID(wellName, plateName) cat(paste(wellID, well$value1, well$value2, sep=","), file=outputFile) } In

How can I add “X” rows to a table in SQL?

心不动则不痛 提交于 2019-12-25 18:42:09
问题 If I have a table, let's say Customers and I want to receive from the user a number (Form) and create X rows in the Customer table. Let's say the customer put the number 4 I want 4 new rows at the Customer Table. How can I do this? insert into Customer Valus ('Helen' , 36 ) 回答1: You could use a stored procedure and then pass the number of customers you want added. Something like this... create procedure AddNewCustomers @NumberOfCustToAdd int as declare @counter int set @counter = 0 while