This has been status-completed with the generous help of Shog9.
So what has been done so far
A new tag dataframe has been created which has the following tags as its synonyms (additional synonym proposals are welcome)
1.1. data.frame
1.2. data-frame
1.3. dataframes
A tag-wiki was created (see below for the first draft) to describe the most common languages associated with this tag (though any additional language specific wikis are more than welcome - hence I'm making this answer a CW)
2.1 r
2.2 python
2.3 apache-spark
As a result, all the questions that were previously tagged with either data.frame or dataframes were automatically reatagged with dataframe to rule them all.
Regarding #4, here is my draft for the dataframe tag wiki. The first paragraph should be fine for the tag wiki excerpt, I think. The non-r parts need some improvement from others and edits anywhere are welcome, so I have marked this community wiki.
Personally, I think we should minimize references to external links, since they shouldn't really be necessary for such a simple topic and make it more work to maintain. Preferably, each language section will be kept short. If we really want to elaborate a ton, well, Docs.SO will be available soon.
Below this line should just be the current draft.
A data frame is a tabular data structure. Usually, it contains data where rows are observations and columns are variables of various types. While data frame or dataframe is the term used for this concept in several languages (R, the pandas library in Python, Apache Spark), table is the term used in MATLAB and SQL.
The sections below correspond to each language that uses this term and are aimed at the level of an audience only familiar with the given language.
data.frame in R
Data frames are one of the basic tabular data structures in the R language, alongside matrices. Unlike matrices, each column can be a different data type. In terms of implementation, a data frame is a list of column vectors, each of which has the same length.
Type ?data.frame
for help constructing a data frame. An example:
data.frame(
x = letters[1:5],
y = 1:5,
z = (1:5) > 3
)
# x y z
# 1 a 1 FALSE
# 2 b 2 FALSE
# 3 c 3 FALSE
# 4 d 4 TRUE
# 5 e 5 TRUE
Related functions include is.data.frame
, which tests whether an object is a data.frame; and as.data.frame
, which coerces many other data structures to data.frame. Data frames have been extended or modified to create new data structures by several R packages, including data.table and dplyr. For further reading, see the paragraph on Data frames in the CRAN manual Intro to R
DataFrame in Python's pandas library
The pandas library in Python is the canonical tabular data framework on the SciPy stack, and the DataFrame is its two-dimensional data object. It is basically a rectangular array like a 2D numpy ndarray, but with associated indices on each axis which can be used for alignment. As in R, from an implementation perspective, columns are somewhat prioritized over rows: the DataFrame resembles a dictionary with column names as keys and Series (pandas' one-dimensional data structure) as values.
After importing numpy and pandas under the usual aliases (import numpy as np
, import pandas as pd
), we can construct a DataFrame in several ways, such as passing a dictionary of column names and values:
>>> pd.DataFrame({"x": list("abcde"), "y": range(1,6), "z": np.arange(1,6) > 3})
x y z
0 a 1 False
1 b 2 False
2 c 3 False
3 d 4 True
4 e 5 True
DataFrame in Apache Spark
A Spark DataFrame is a distributed collection of data organized into named columns. It is conceptually equivalent to a table in a relational database or a data frame in R/Python, but with richer optimizations under the hood. DataFrames can be constructed from a wide array of sources such as: structured data files, tables in Hive, external databases, or existing RDDs. (source)