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
25
votes
2 answers

change data.frame column into rows in R

A <- c(1,6) B <- c(2,7) C <- c(3,8) D <- c(4,9) E <- c(5,0) df <- data.frame(A,B,C,D,E) df A B C D E 1 1 2 3 4 5 2 6 7 8 9 0 I would like to have this: df 1 2 A 1 6 B 2 7 C 3 8 D 4 9 E 5 0
tora0515
  • 2,479
  • 12
  • 33
  • 40
25
votes
2 answers

Does the space occupied by deleted rows get re-used?

I have read several times that after you delete a row in an InnoDB table in MySQL, its space is not reused, so if you make a lot of INSERTs into a table and then periodically DELETE some rows the table will use more and more space on disk, as if the…
user1411272
25
votes
2 answers

Equal height of elements inside grid item with CSS grid layout

I have a sequence of articles inside a div of 4+ length, without any rounding row tag. I need to represent it as a table of 3 articles (columns) per row, probably with display: grid. Every article has a header, a section and a footer. How would I…
Igor Yudnikov
  • 434
  • 1
  • 6
  • 14
25
votes
3 answers

sum cells of certain columns for each row

I would like to calculate sums for certain columns and then apply this summation for every row. Unfortunately, I can only get to the first step. How do I now make it happen for each row? I know that R doesn't need loops; what are good approaches? My…
user1807857
  • 409
  • 1
  • 5
  • 12
24
votes
4 answers

Find which rows have different values for a given column in Teradata SQL

I am trying to compare two addresses from the same ID to see whether they match. For example: Id Adress Code Address 1 1 123 Main 1 2 123 Main 2 1 456 Wall 2 2 456 Wall 3 1 …
Hatt
  • 689
  • 4
  • 9
  • 23
23
votes
2 answers

How do I retrieve a matrix column and row name by a matrix index value?

So let's say I have a matrix, mdat and I only know the index number. How do I retrieve the column and row names? For example: > mdat <- matrix(c(1,2,3, 11,12,13), nrow = 2, ncol=3, byrow=TRUE, dimnames = list(c("row1", "row2"), c("C.1", "C.2",…
user1301593
  • 631
  • 1
  • 6
  • 16
22
votes
3 answers

Deleting every n-th row in a dataframe

How can I delete every n-th row from a dataframe in R?
Yktula
  • 14,179
  • 14
  • 48
  • 71
22
votes
5 answers

Removing rows from R data frame

I have the following data frame: > str(df) 'data.frame': 3149 obs. of 9 variables: $ mkod : int 5029 5035 5036 5042 5048 5050 5065 5071 5072 5075 ... $ mad : Factor w/ 65 levels "Akgün Kasetçilik ",..: 58 29 59 40 56 11 33 34 19 20…
Mehper C. Palavuzlar
  • 10,089
  • 23
  • 56
  • 69
20
votes
4 answers

Apply multiple functions to each row of a dataframe

Every time I think I understand about working with vectors, what appears to be a simple problem turns my head inside out. Lot's of reading and trying different examples hasn't helped on this occasion. Please spoon feed me here... I want to apply two…
Look Left
  • 1,305
  • 3
  • 15
  • 20
20
votes
9 answers

How do I make a HTML div go under another div?

This text floats left
Text 2
When I try to do this, and try to make a…
DarkLightA
  • 14,980
  • 18
  • 49
  • 57
19
votes
3 answers

MongoDB Database, equivalent for SELECT column1, column2 FROM tbl

From my MongoDB I want the equivalent for SELECT column1, column2 FROM tbl With this code I get all the 'rows' but also all the 'columns' DBCollection collection = database.getCollection("names"); DBCursor cursor = collection.find(); I for…
Marc Stevens
  • 353
  • 2
  • 4
  • 11
19
votes
3 answers

What are the max rows for MySQL table

Note: I've searched for other similar Qs here, and none of the other answered questions are even remotely similar.. With that... I have a question about MySql tables (more precisely, on specific fields from a table- i.e. tweets or updates ). So the…
avon_verma
  • 1,229
  • 3
  • 12
  • 17
19
votes
4 answers

Swapping rows within the same pandas dataframe

I'm trying to swap the rows within the same DataFrame in pandas. I've tried running a = pd.DataFrame(data = [[1,2],[3,4]], index=range(2), columns = ['A', 'B']) b, c = a.iloc[0], a.iloc[1] a.iloc[0], a.iloc[1] = c, b but I just end up with both the…
Zac
  • 329
  • 1
  • 3
  • 8
19
votes
2 answers

Combine multiple rows into multiple columns dynamically in SQL Server

I have a large database table on which I need to perform the action below dynamically using Microsoft SQL Server. From a result like this: badge | name | Job | KDA | Match - - - - - - - - - - - - - - - - T996 | Darrien | AP…
chabu
  • 201
  • 1
  • 2
  • 6
19
votes
4 answers

Remove NA/NaN/Inf in a matrix

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))…
user2199881
  • 211
  • 1
  • 3
  • 7