Questions tagged [row]

A horizontal line of cells in a spreadsheet, SQL table, HTML table, or similar structure.

A row most commonly refers to a horizontal line of cells in a spreadsheet or similar structure.

6641 questions
516
votes
11 answers

jQuery: count number of rows in a table

How do I count the number of tr elements within a table using jQuery? I know there is a similar question, but I just want the total rows.
danjan
439
votes
7 answers

How do I add indices to MySQL tables?

I've got a very large MySQL table with about 150,000 rows of data. Currently, when I try and run SELECT * FROM table WHERE id = '1'; the code runs fine as the ID field is the primary index. However, for a recent development in the project, I have…
Michael
  • 4,825
  • 4
  • 18
  • 12
257
votes
8 answers

How do I delete rows in a data frame?

I have a data frame named "mydata" that looks like this this: A B C D 1. 5 4 4 4 2. 5 4 4 4 3. 5 4 4 4 4. 5 4 4 4 5. 5 4 4 4 6. 5 4 4 4 7. 5 4 4 4 I'd like to delete row 2,4,6. For example, like this: …
R newbie
  • 2,635
  • 2
  • 11
  • 5
246
votes
11 answers

Find row where values for column is maximal in a pandas DataFrame

How can I find the row for which the value of a specific column is maximal? df.max() will give me the maximal value for each column, I don't know how to get the corresponding row.
lazy1
  • 11,601
  • 3
  • 35
  • 44
172
votes
26 answers

In MySQL, can I copy one row to insert into the same table?

insert into table select * from table where primarykey=1 I just want to copy one row to insert into the same table (i.e., I want to duplicate an existing row in the table) but I want to do this without having to list all the columns after the…
lina
  • 1,721
  • 2
  • 11
  • 4
172
votes
6 answers

Pandas dataframe get first row of each group

I have a pandas DataFrame like following. df = pd.DataFrame({'id' : [1,1,1,2,2,3,3,3,3,4,4,5,6,6,6,7,7], 'value' : ["first","second","second","first", "second","first","third","fourth", …
Nilani Algiriyage
  • 22,706
  • 29
  • 77
  • 114
168
votes
19 answers

How to add a new row to datagridview programmatically

if add row to DataTable DataRow row = datatable1.NewRow(); row["column2"]="column2"; row["column6"]="column6"; datatable1.Rows.Add(row); How about DataGridView??
LK Yeung
  • 3,226
  • 5
  • 22
  • 38
151
votes
11 answers

How to insert a row in an HTML table body in JavaScript

I have an HTML table with a header and a footer: …
Jérôme Verstrynge
  • 51,859
  • 84
  • 263
  • 429
151
votes
4 answers

Python pandas: fill a dataframe row by row

The simple task of adding a row to a pandas.DataFrame object seems to be hard to accomplish. There are 3 stackoverflow questions relating to this, none of which give a working answer. Here is what I'm trying to do. I have a DataFrame of which I…
xApple
  • 5,393
  • 9
  • 41
  • 46
134
votes
7 answers

Fast way to discover the row count of a table in PostgreSQL

I need to know the number of rows in a table to calculate a percentage. If the total count is greater than some predefined constant, I will use the constant value. Otherwise, I will use the actual number of rows. I can use SELECT count(*) FROM…
Renato Dinhani
  • 30,005
  • 49
  • 125
  • 194
132
votes
7 answers

Select random row from a sqlite table

I have a sqlite table with the following schema: CREATE TABLE foo (bar VARCHAR) I'm using this table as storage for a list of strings. How do I select a random row from this table?
Alex_coder
  • 1,980
  • 2
  • 16
  • 15
107
votes
7 answers

How to fix height of TR?

Is it possible to fix the height of a row (tr) on a table? The problem appears when I shrink the window of the browser, some rows start playing around, and I can not fix the height of the row. I tried several ways: tr width="20" / tr…
Amra
  • 22,647
  • 26
  • 78
  • 92
104
votes
9 answers

Python Pandas Replacing Header with Top Row

I currently have a dataframe that looks like this: Unnamed: 1 Unnamed: 2 Unnamed: 3 Unnamed: 4 0 Sample Number Group Number Sample Name Group Name 1 1.0 1.0 s_1 g_1 2 2.0 …
Jeremy G
  • 1,269
  • 2
  • 10
  • 14
94
votes
7 answers

Padding a table row

Table Row Padding Issue
My Header
aaaaa
Spencer
  • 3,478
  • 8
  • 28
  • 43
82
votes
7 answers

How to align left last row/line in multiple line flexbox

I have a major issue with flexbox layout. I build a container with a boxes filled with images, and i decided to use flexbox layout to justify the content to make it looks like a grid Her's the code:
PuZ
  • 823
  • 1
  • 7
  • 5
1
2 3
99 100