Search code examples
pythonlistdataframeaddition

Add Dataframe to list of dataframes


I have the following list of Dataframes twice: List of Dataframes

Now i want to combine these lists to one list. So i want to add all the Dataframes from list two to list one.

Simple example:

a = pd.DataFrame([2,3,4,5])
b = pd.DataFrame([4,7,8,9,10])

c = [a,b]

d = pd.DataFrame([2,3,4,5])
e = pd.DataFrame([4,7,8,9,10])

f = [d,e]

# New list automatically:
g = [a,b,d,e]

Solution

  • You want to expand your list:

    g = c + f
    

    For example:

    [1, 2, 3] + [4, 5, 6]
    >>> [1, 2, 3, 4, 5, 6]