emat/util/one_hot.py
def categorical_expansion_all(df, inplace=False, drop=True):
	"""One-hot encode all categorical columns of a DataFrame.

	Args:
		df (pandas.DataFrame): The input dataframe
		inplace (bool, default False): Whether to make the expansion in-place.
		drop (bool, default False): If true, drop the existing categorical
			columns from `df`.

	Returns:
		pandas.DataFrame: Only if inplace is false.
	"""

	if inplace:
		d = df
	else:
		d = df.copy()

	d_dtypes = d.dtypes

	for col in d_dtypes[d_dtypes == 'category'].index:
		categorical_expansion(d, column=col, inplace=True, drop=drop)

	if not inplace:
		return d
One-hot encode all categorical columns of a DataFrame.

	Args:
		df (pandas.DataFrame): The input dataframe
		inplace (bool, default False): Whether to make the expansion in-place.
		drop (bool, default False): If true, drop the existing categorical
			columns from `df`.

	Returns:
		pandas.DataFrame: Only if inplace is false.
	
One-hot encode all categorical columns of a DataFrame.
One - hot encode all categorical columns of a DataFrame .
def categorical_expansion_all(df, inplace=False, drop=True):
	if inplace:
		d = df
	else:
		d = df.copy()
	d_dtypes = d.dtypes
	for col in d_dtypes[d_dtypes == 'category'].index:
		categorical_expansion(d, column=col, inplace=True, drop=drop)
	if not inplace:
		return d
def categorical_expansion_all ( df , inplace = False , drop = True ) : if inplace : d = df else : d = df . copy ( ) d_dtypes = d . dtypes for col in d_dtypes [ d_dtypes == 'category' ] . index : categorical_expansion ( d , column = col , inplace = True , drop = drop ) if not inplace : return d
One-hot encode all categorical columns of a DataFrame.
One - hot encode all categorical columns of a DataFrame .
"""One-hot encode all categorical columns of a DataFrame.

	Args:
		df (pandas.DataFrame): The input dataframe
		inplace (bool, default False): Whether to make the expansion in-place.
		drop (bool, default False): If true, drop the existing categorical
			columns from `df`.

	Returns:
		pandas.DataFrame: Only if inplace is false.
	"""
Only if inplace is false.
Only if inplace is false .
pandas.DataFrame
df
The input dataframe
The input dataframe
inplace
Whether to make the expansion in-place.
Whether to make the expansion in - place .
drop
If true, drop the existing categorical
columns from `df`.
If true drop the existing categorical columns from ` df ` .