Questions tagged [rows]

A row is a single data item in a database, spreadsheet, table, grid or list. When using this tag, please also add additional tags to clarify your specific environment/language/use case.

A row is a single data item. In the context of a database or similar data structure, it's also known as a or and will have a well-defined structure. In the context of a dataset in data science, each row represents an observation.

Rows can also be added to a less structured data source, such as a , , grid or .

4419 questions
242
votes
10 answers

Numpy - add row to array

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…
Darren J. Fitzpatrick
  • 7,159
  • 14
  • 45
  • 49
205
votes
9 answers

For each row in an R dataframe

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…
Carl Coryell-Martin
  • 3,410
  • 3
  • 26
  • 23
126
votes
7 answers

How to append rows to an R data frame

I have looked around StackOverflow, but I cannot find a solution specific to my problem, which involves appending rows to an R data frame. I am initializing an empty 2-column data frame, as follows. df = data.frame(x = numeric(), y =…
Gyan Veda
  • 6,309
  • 11
  • 41
  • 66
123
votes
10 answers

Repeat rows of a data.frame

I want to repeat the rows of a data.frame, each N times. The result should be a new data.frame (with nrow(new.df) == nrow(old.df) * N) keeping the data types of the columns. Example for N = 2: A B C A B C 1…
Stefan
  • 1,530
  • 2
  • 11
  • 9
107
votes
10 answers

Convert multiple rows into one with comma as separator

If I issue SELECT username FROM Users I get this result: username -------- Paul John Mary but what I really need is one row with all the values separated by comma, like this: Paul, John, Mary How do I do this?
Pavel Bastov
  • 6,911
  • 7
  • 39
  • 48
100
votes
7 answers

SQL count rows in a table

I need to send a SQL query to a database that tells me how many rows there are in a table. I could get all the rows in the table with a SELECT and then count them, but I don't like to do it this way. Is there some other way to ask the number of the…
Celeste Capece
  • 1,306
  • 2
  • 11
  • 20
96
votes
3 answers

Is there a way to suppress "x rows affected" in SQLCMD from the command line?

Is there a way to suppress "x rows affected" in SQLCMD from the command line? I'm running an MSBuild script and don't want it clogging up my log on my build server. I'd rather not have to add "SET NOCOUNT ON" in every script, so if there's a way…
Josh Kodroff
  • 27,301
  • 27
  • 95
  • 148
89
votes
3 answers

Select only rows if its value in a particular column is less than the value in the other column

I am using R and need to select rows with aged (age of death) less than or equal to laclen (lactation length). I am trying to create a new data frame to only include rows/ids whereby the value of column'aged' is less than its corresponding…
Bazon
  • 1,233
  • 2
  • 10
  • 7
86
votes
6 answers

Adding rows to tbody of a table using jQuery

I am trying to add rows to the tbody of a table. But I am having issues with achieving that. Firstly, the function where everything takes place is called on change of a dropdown from a html page. I created a tr string containing all the td inside…
Anupam
  • 1,821
  • 3
  • 23
  • 41
85
votes
3 answers

pandas - change df.index from float64 to unicode or string

I want to change a dataframes' index (rows) from float64 to string or unicode. I thought this would work but apparently not: #check type type(df.index) 'pandas.core.index.Float64Index' #change type to unicode if not isinstance(df.index, unicode): …
Boosted_d16
  • 13,340
  • 35
  • 98
  • 158
77
votes
7 answers

Delete rows containing specific strings in R

I would like to exclude lines containing a string "REVERSE", but my lines do not match exactly with the word, just contain it. My input data frame: Value Name 55 REVERSE223 22 GENJJS 33 REVERSE456 44 …
user3091668
  • 2,230
  • 6
  • 25
  • 42
77
votes
4 answers

More than 1 row in

I'm having troubles getting my to have more than 1 row, I tried adding the properties in the html, like you would do with a normal like this: I even tried to…
Jonas Pedersen
  • 911
  • 2
  • 10
  • 21
76
votes
7 answers

Python: Number of rows affected by cursor.execute("SELECT ...)

How can I access the number of rows affected by: cursor.execute("SELECT COUNT(*) from result where server_state='2' AND name LIKE '"+digest+"_"+charset+"_%'")
Tie-fighter
  • 1,035
  • 2
  • 8
  • 9
55
votes
15 answers

Excel CSV. file with more than 1,048,576 rows of data

I have been given a CSV file with more than the MAX Excel can handle, and I really need to be able to see all the data. I understand and have tried the method of "splitting" it, but it doesnt work. Some background: The CSV file is an Excel CSV file,…
Ostrich_Cloud
  • 551
  • 1
  • 4
  • 3
48
votes
6 answers

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

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 | …
mahdi yousefi
  • 807
  • 1
  • 9
  • 15
1
2 3
99 100