'How to efficiently create a DataFrame(pandas) of the entire case for all 4 elements of a list?(python) [duplicate]
import pandas as pd
list_1 = [1, 2, 3, 4, 5]
list_2 = [a, b, c, d, e]
list_3 = [123, 456, 789]
list_4 = [1, 2, 3, 4, 5, 6, 7, 8 ,9, ... , 100]
I have 4 lists.
I want a DataFrame about all cases.
I want to avoid loops as much as possible.
Result Example
col1 | col2 | col3 | col4
row1 | 1 | a | 325 | 1
row2 | 1 | a | 325 | 2
row3 | 1 | a | 325 | 3
.
.
.
row7500| 5 | e | 789 | 100
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
