datar.apis.tibble
datar.apis.tibble
add_column(_data,*args,_before,_after,_name_repair,_dtypes,**kwargs)(Any) — Add one or more columns to an existing data frame.</>add_row(_data,*args,_before,_after,**kwargs)(Any) — Add one or more rows of data to an existing data frame.</>as_tibble(df)(Any) — Convert a DataFrame object to Tibble object</>column_to_rownames(_data,var)(Any) — Set rownames/index with one column, and remove it</>deframe(x)(Any) — Converts two-column data frames to a dictionaryusing the first column as name and the second column as value. If the input has only one column, a list. </>enframe(x,name,value)(Any) — Converts mappings or lists to one- or two-column data frames.</>has_rownames(_data)(bool) — Detect if a data frame has row names</>remove_rownames(_data)(Any) — Remove the index/rownames of a data frame</>rowid_to_column(_data,var)(Any) — Add rownames as a column</>rownames_to_column(_data,var)(Any) — Add rownames as a column</>tibble(*args,_name_repair,_rows,_dtypes,_drop_index,_index,**kwargs)(Any) — Constructs a data frame</>tibble_row(*args,_name_repair,_dtypes,**kwargs)(Any) — Constructs a data frame that is guaranteed to occupy one row.Scalar values will be wrapped with[]</>tribble(*dummies,_name_repair,_dtypes)(Any) — Create dataframe using an easier to read row-by-row layoutUnlike original API that uses formula (f.col) to indicate the column names, we usef.colto indicate them. </>
datar.apis.tibble.tibble(*args, _name_repair='check_unique', _rows=None, _dtypes=None, _drop_index=False, _index=None, **kwargs)
Constructs a data frame
*args— and_name_repair(Union, optional) — treatment of problematic column names:- - "minimal": No name repair or checks, beyond basic existence,
- - "unique": Make sure names are unique and not empty,
- - "check_unique": (default value), no name repair,
but check they are unique, - - "universal": Make the names unique and syntactic
- - a function: apply custom name repair
_rows(int, optional) — Number of rows of a 0-col dataframe when args and kwargs arenot provided. When args or kwargs are provided, this is ignored._dtypes(optional) — The dtypes for each columns to convert to._drop_index(bool, optional) — Whether drop the index for the final data frame_index(optional) — The new index of the output frame**kwargs— A set of name-value pairs.
A constructed tibble
datar.apis.tibble.tribble(*dummies, _name_repair='minimal', _dtypes=None)
Create dataframe using an easier to read row-by-row layoutUnlike original API that uses formula (f.col) to indicate the column
names, we use f.col to indicate them.
*dummies— Arguments specifying the structure of a dataframeVariable names should be specified withf.name_dtypes(optional) — The dtypes for each columns to convert to.
>>> tribble(>>> f.colA, f.colB,
>>> "a", 1,
>>> "b", 2,
>>> "c", 3,
>>> )
A dataframe
datar.apis.tibble.tibble_row(*args, _name_repair='check_unique', _dtypes=None, **kwargs)
Constructs a data frame that is guaranteed to occupy one row.Scalar values will be wrapped with []
*args— and_name_repair(Union, optional) — treatment of problematic column names:- - "minimal": No name repair or checks, beyond basic existence,
- - "unique": Make sure names are unique and not empty,
- - "check_unique": (default value), no name repair,
but check they are unique, - - "universal": Make the names unique and syntactic
- - a function: apply custom name repair
**kwargs— A set of name-value pairs.
A constructed dataframe
datar.apis.tibble.as_tibble(df) → Any
Convert a DataFrame object to Tibble object
datar.apis.tibble.enframe(x, name='name', value='value')
Converts mappings or lists to one- or two-column data frames.
x— a list, a dictionary or a dataframe with one or two columnsname(optional) — andvalue(optional) — value Names of the columns that store the names and values.IfNone, a one-column dataframe is returned.valuecannot beNone
A data frame with two columns if name is not None (default) orone-column otherwise.
datar.apis.tibble.deframe(x)
Converts two-column data frames to a dictionaryusing the first column as name and the second column as value. If the input has only one column, a list.
x— A data frame.
A dictionary or a list if only one column in the data frame.
datar.apis.tibble.add_row(_data, *args, _before=None, _after=None, **kwargs)
Add one or more rows of data to an existing data frame.
Aliases add_case
_data— Data frame to append to.*args— and_before(optional) — and_after(optional) — row index where to add the new rows.(default to add after the last row)**kwargs— Name-value pairs to add to the data frame.
The dataframe with the added rows
datar.apis.tibble.add_column(_data, *args, _before=None, _after=None, _name_repair='check_unique', _dtypes=None, **kwargs)
Add one or more columns to an existing data frame.
_data— Data frame to append to*args— and_before(optional) — and_after(optional) — Column index or name where to add the new columns(default to add after the last column)_dtypes(optional) — The dtypes for the new columns, either a uniform dtype or adict of dtypes with keys the column names**kwargs— Name-value pairs to add to the data frame
The dataframe with the added columns
datar.apis.tibble.has_rownames(_data)
Detect if a data frame has row names
Aliases has_index
_data— The data frame to check
True if the data frame has index otherwise False.
datar.apis.tibble.remove_rownames(_data)
Remove the index/rownames of a data frame
Aliases remove_index, drop_index, remove_rownames
_data— The data frame
The data frame with index removed
datar.apis.tibble.rownames_to_column(_data, var='rowname')
Add rownames as a column
Aliases index_to_column
_data— The data framevar(optional) — The name of the column
The data frame with rownames added as one column. Note that theoriginal index is removed.
datar.apis.tibble.rowid_to_column(_data, var='rowid')
Add rownames as a column
_data— The data framevar(optional) — The name of the column
The data frame with row ids added as one column.
datar.apis.tibble.column_to_rownames(_data, var='rowname')
Set rownames/index with one column, and remove it
Aliases column_to_index
_data— The data framevar(optional) — The column to conver to the rownames
The data frame with the column converted to rownames