Pandas Split Dataframe into two Dataframes at a specific row

后端 未结 3 658
既然无缘
既然无缘 2020-12-02 16:27

I have pandas DataFrame which I have composed from concat. One row consists of 96 values, I would like to split the DataFrame from the value 72.

3条回答
  •  情书的邮戳
    2020-12-02 16:58

    I generally use array split because it's easier simple syntax and scales better with more than 2 partitions.

    import numpy as np
    partitions = 2
    dfs = np.array_split(df, partitions)
    

    np.split(df, [100,200,300], axis=0] wants explicit index numbers which may or may not be desirable.

提交回复
热议问题