rows

Remove NA/NaN/Inf in a matrix

拥有回忆 提交于 2019-12-17 16:37:05
问题 I want to try two things : How do I remove rows that contain NA/NaN/Inf How do I set value of data point from NA/NaN/Inf to 0. So far, I have tried using the following for NA values, but been getting warnings. > eg <- data[rowSums(is.na(data)) == 0,] Error in rowSums(is.na(data)) : 'x' must be an array of at least two dimensions In addition: Warning message: In is.na(data) : is.na() applied to non-(list or vector) of type 'closure' 回答1: I guess I'll throw my hat into the ring with my

Get previous and next row from rows selected with (WHERE) conditions

a 夏天 提交于 2019-12-17 15:43:21
问题 For example I have this statement: my name is Joseph and my father's name is Brian This statement is splitted by word, like this table: ------------------------------ | ID | word | ------------------------------ | 1 | my | | 2 | name | | 3 | is | | 4 | Joseph | | 5 | and | | 6 | my | | 7 | father's | | 8 | name | | 9 | is | | 10 | Brian | ------------------------------ I want to get previous and next word of each word For example I want to get previous and next word of "name": ---------------

Concatenating multiple rows, with multiple values in it, into single line in MS Access

大城市里の小女人 提交于 2019-12-17 14:53:58
问题 I am trying to create simple requirements management database. Basically I have 2 tables like below: Contract_requirements with 2 columns: CR_ReqID | Description reqCR1 | Contract req description 1 reqCR2 | Contract req description 2 SW_requirements Title | SW_ReqID | RootReq SW req description 1| reqSW1 | reqCR1, reqCR2 SW req description 2| reqSW2 | reqCR1 SW req description 3| reqSW3 | reqCR2 And I would like to write query to receive such a table: CR_ReqID |Description |where used? reqCR1

Converting Columns into rows with their respective data in sql server

吃可爱长大的小学妹 提交于 2019-12-17 12:48:24
问题 I have a scenario where I need to convert columns of table to rows eg - table - stocks: ScripName ScripCode Price ----------------------------------------- 20 MICRONS 533022 39 I need to represent the table in the following format, but I just need this kind of representation for single row ColName ColValue ----------------------------- ScripName 20 MICRONS ScripCode 533022 Price 39 so that I can directly bind the data to the datalist control. 回答1: declare @T table (ScripName varchar(50),

How to remove rows with any zero value

喜你入骨 提交于 2019-12-17 07:14:18
问题 I have a problem to solve how to remove rows with a Zero value in R. In others hand, I can use na.omit() to delete all the NA values or use complete.cases() to delete rows that contains NA values. Is there anyone know how to remove rows with a Zero Values in R? For example : Before | DateTime | Mac1 | Mac2 | Mac3 | Mac4 | ---------------------------------------------------- | 2011-04-02 06:00 | 20 | 0 | 20 | 20 | | 2011-04-02 06:05 | 21 | 21 | 21 | 21 | | 2011-04-02 06:10 | 22 | 22 | 22 | 22

Concatenating multiple rows into single line in MS Access [duplicate]

烂漫一生 提交于 2019-12-17 06:53:32
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Combine rows in Access 2007 Access 2007 - Concatenate fields from one column in one table into a single, comma delmited value in another table Currently I have a table structure that is somewhat like this: Name --- Cat --- Desc --- Thresh --- Perc --- Err --- BP Bob -------C1-------Inf--------7Per--------0.05------0-----ADC2 Bob -------C1-------Inf--------7Per--------0.05------2-----BAC2 Bob -------C1-------Inf-

Compare Python Pandas DataFrames for matching rows

别等时光非礼了梦想. 提交于 2019-12-17 06:37:08
问题 I have this DataFrame ( df1 ) in Pandas: df1 = pd.DataFrame(np.random.rand(10,4),columns=list('ABCD')) print df1 A B C D 0.860379 0.726956 0.394529 0.833217 0.014180 0.813828 0.559891 0.339647 0.782838 0.698993 0.551252 0.361034 0.833370 0.982056 0.741821 0.006864 0.855955 0.546562 0.270425 0.136006 0.491538 0.445024 0.971603 0.690001 0.911696 0.065338 0.796946 0.853456 0.744923 0.545661 0.492739 0.337628 0.576235 0.219831 0.946772 0.752403 0.164873 0.454862 0.745890 0.437729 I would like to

remove IDs that occur x times R

删除回忆录丶 提交于 2019-12-17 05:13:31
问题 I have a df and I would like to remove people who have less than X amount of rows in df. E.g., in this toy example, I would like to retain people who have >= 5 rows. df names fruit 4 john kiwi 7 john apple 9 john banana 13 john orange 14 john apple 2 mary orange 5 mary apple 8 mary orange 10 mary apple 12 mary apple 1 tom apple 3 tom banana 6 tom apple 11 tom kiwi example output df names fruit 4 john kiwi 7 john apple 9 john banana 13 john orange 14 john apple 2 mary orange 5 mary apple 8

Numpy - add row to array

依然范特西╮ 提交于 2019-12-17 04:45:52
问题 How does one add rows to a numpy array? I have an array A: A = array([[0, 1, 2], [0, 2, 0]]) I wish to add rows to this array from another array X if the first element of each row in X meets a specific condition. Numpy arrays do not have a method 'append' like that of lists, or so it seems. If A and X were lists I would merely do: for i in X: if i[0] < 3: A.append(i) Is there a numpythonic way to do the equivalent? Thanks, S ;-) 回答1: What is X ? If it is a 2D-array, how can you then compare

how plot per rows in gnuplot

放肆的年华 提交于 2019-12-14 03:58:14
问题 I have a file with this format 0 R1 R2 R3 R4 w1 I1 I2 I3 I4 w2 I1 I2 I3 I4 w3 I1 I2 I3 I4 with values of radius R and intensity I in many wavelengths w. I want to plot in 2D, the row 1 (the radius) in the x-axis and row 3 in the y-axis (choosing w2). how plot per lines? not per columns 回答1: It's perhaps not the most elegant solution but you could first filter the two lines (the header containing the x-values and the line corresponding to the wavelength of interest), print them side by side,