1. How to make multiple columns
Apply method and Vectorization which can be used to apply a function on dataframe and return multiple new columns. The task making multiple columns is parsing column 'Memory' into 'HDD', 'SSD', 'Flash', 'Hybrid'.

2. Use Pandas Apply function
First, i will use pandas.series.apply() to apply the parsing_memory() function on the dataframe column 'Memory' to parse the memory size by creating three new columns 'HDD', 'SSD', 'Flash', and 'Hybrid' respectively. In apply function, the default argument of axis = 0. In axis = 0, values are iterated by rows.
Source of article :
https://kanoki.org/2022/02/11/how-to-return-multiple-columns-using-pandas-apply/
How to return multiple columns using pandas apply
In this article we are going to compare the performance of two approaches i.e. Apply method and Vectorization which can be used to apply a function on dataframe and return multiple new columns
kanoki.org
'Programming > Python' 카테고리의 다른 글
| [DS] Heap (0) | 2022.09.03 |
|---|---|
| [DS] Queue (0) | 2022.09.03 |
| [Error] Error and Exception (0) | 2022.08.16 |
| [BeautifulTable] Print list object in table format (0) | 2022.07.04 |
| [BeautifulSoup] Web Scraping (0) | 2022.07.03 |