在另一个表上添加表,以便它们继续

时间:2019-02-17 16:49:25

标签: python pandas dataframe

我有一个包含10行的DataFrame,我想在这10行中再添加三个表,以便它们一个接一个地继续。下一张表以11和21的第三个开始。

这是DataFrame

Date    Open    High    Low     Close   Adj Close   Volume
0   2019-01-17  346.209991  351.500000  344.149994  347.309998     347.309998   3676700
1   2019-01-18  323.000000  327.130005  299.730011  302.260010  302.260010  24150800
2   2019-01-22  304.820007  308.000000  295.500000  298.920013  298.920013  12066700
3   2019-01-23  292.500000  294.500000  281.690002  287.589996  287.589996  12530000
4   2019-01-24  283.029999  293.679993  279.279999  291.510010  291.510010  8012200
5   2019-01-25  294.390015  298.519989  289.549988  297.040009  297.040009  7249600
6   2019-01-28  292.910004  297.459991  287.750000  296.380005  296.380005  6423300
7   2019-01-29  295.269989  298.559998  291.799988  297.459991  297.459991  4621700
8   2019-01-30  300.450012  309.000000  298.489990  308.769989  308.769989  11250300
9   2019-01-31  301.000000  311.559998  294.000000  307.019989  307.019989  12569200
10  2019-02-01  305.420013  316.100006  303.500000  312.209991  312.209991  7283400

1 个答案:

答案 0 :(得分:0)

您可以使用pandas.DataFrame.append。从文档中:

df1 = pd.DataFrame([[1, 2], [3, 4]], columns=list('AB'))
df2 = pd.DataFrame([[5, 6], [7, 8]], columns=list('AB'))

combined_df = df1.append(df2)

更多信息: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.append.html#pandas.DataFrame.append