In [1]:
import pandas as pd
import numpy as np
In [2]:
ts1 = [1,2,3,4]
ts2 = [6,7,8,9]
d = {'col_1': ts1, 'col_2': ts2}
In [3]:
d
Out[3]:
In [4]:
df_1 = pd.DataFrame(data=d)
In [5]:
df_1
Out[5]:
In [6]:
df_2 = pd.DataFrame(np.random.randn(3, 2), columns=['col_1', 'col_2'])
In [7]:
df_2
Out[7]:
In [8]:
df_all = pd.concat((df_1, df_2), axis=0, ignore_index=True)
In [9]:
df_all
Out[9]:
In [10]:
print(df_1.shape)
print(df_2.shape)
print(df_all.shape)
In [11]:
df_train = df_all[:df_1.shape[0]]
df_test = df_all[df_1.shape[0]:]
In [12]:
print(df_train.shape)
print(df_test.shape)
print(df_all.shape)
In [ ]: