Separate Function¶
Separate string list to Pandas DataFrame
-
tools.separate.
separate
(series, index=None, columns=None, otherwise=nan)¶ Separate string list to Pandas DataFrame
Parameters: - series (list of list or Series of list) –
- index (filter return index) –
- columns (return column name of DataFrame) –
- otherwise (numpy.NaN, fill value of not exist value) –
Returns: Return type: Pandas DataFrame with split each element of series to column
Examples
>>> from tidyframe.tools import separate >>> df = pd.DataFrame({'full_string': ['a b c d e z', 'f g h i']}, ... index=['row_1', 'row_2']) >>> series = df.full_string.str.split(' ') >>> separate(series) col_0 col_1 col_2 col_3 col_4 col_5 row_1 a b c d e z row_2 f g h i NaN NaN