问题是非常自我解释的,如何在给定点(索引10和11之间)中将具有几个值的数据帧插入到更大的数据帧中。意味着.append无法使用
答案 0 :(得分:0)
您可以remove
使用closest
切片np.random.seed(100)
df1 = pd.DataFrame(np.random.randint(100, size=(5,6)), columns=list('ABCDEF'))
print (df1)
A B C D E F
0 8 24 67 87 79 48
1 10 94 52 98 53 66
2 98 14 34 24 15 60
3 58 16 9 93 86 2
4 27 4 31 1 13 83
df2 = pd.DataFrame({'A':[1,2,3],
'B':[4,5,6],
'C':[7,8,9],
'D':[1,3,5],
'E':[5,3,6],
'F':[7,4,3]})
print (df2)
A B C D E F
0 1 4 7 1 5 7
1 2 5 8 3 3 4
2 3 6 9 5 6 3
#inserted between 4 and 5 index values
print (pd.concat([df1.loc[:4], df2, df1.loc[4:]], ignore_index=True))
A B C D E F
0 8 24 67 87 79 48
1 10 94 52 98 53 66
2 98 14 34 24 15 60
3 58 16 9 93 86 2
4 27 4 31 1 13 83
5 1 4 7 1 5 7
6 2 5 8 3 3 4
7 3 6 9 5 6 3
8 27 4 31 1 13 83
{/ 3>}。
public abstract class NumberTableModel
{
[Key]
public int RowID { get; }
public int SensorID { get; }
public DateTime ReadingDate { get; }
public int ReadingCount { get; }
public float ApproxDataSize { get; }
public Time ReadingTime { get; }
public string JsonData { get; }
public long LastUpdate { get; }
public string Source { get; }
}
public class NumberTableModel1 : NumberTableModel { }
public class NumberTableModel2: NumberTableModel { }
public class NumberTableModel3: NumberTableModel { }