Finally, pandas DataFrames can be created by merging series or other list-like data. Note that scalars are transformed into lists, as follows:
In: import pandas as pd my_own_dataset = pd.DataFrame({'Col1': range(5), 'Col2': [1.0]*5, 'Col3': 1.0, 'Col4': 'Hello World!'}) my_own_dataset
Here is the output for my_own_dataset:
It can be easily said that for each of the columns you want to be stacked together, you provide their names (as the dictionary key) and values (as the dictionary value for that key). As seen in the preceding example, Col2 and Col3 are created in two different ways, but they provide the same resulting ...