from pandas import DataFrame
import pandas as pd
df_1 = pd.DataFrame(
{
'Horses':["Horse1","Horse2","Horse3"],
'Age':[2,5,3],
'Price':["$100,000","$80,000","$60,000"],
'Weight':["180g","140kg","240kg"]})
df_2 = pd.DataFrame(
{
'Horses':["Horse4","Horse1","Horse5"],
'Age':[4,3,2],
'Price':["$75,000","$35,000","$120,000"],
'Weight':["210kg","110kg","197kg"]})
df_final = pd.DataFrame(
{
'Horses':["Horse1","Horse2","Horse3","Horse4","Horse5"],
'Age':[2,5,3,4,2],
'Price':["$100,000","$80,000","$60,000","$75,000","$120,000"],
'Weight':["180g","140kg","240kg","210kg","197kg"]})
如何从前两个数据帧 bf_1 和 bf_2 创建 df_final DataFrame ?
我该如何编码这个条件:如果输入“Horse1”,它会像上面一样被擦除,否则它会被添加到底部
阿晨1998
相关分类