如何仅使用特定列从现有df创建新df

时间:2019-03-31 07:28:07

标签: pandas

我有一个称为match的数据帧,其中包含以下列: id,season,city,date,team 1,team 2,toss_winner,toss_decision,result,DL_applied winner,win_by_runs,win_by_wickets,player_of_match,venue,umpire 1,umpire 2, umpire 3

由此,我需要创建一个新的数据帧,称为matches_compact,其中应包含以下列: id, season, date and winner

1 个答案:

答案 0 :(得分:1)

matches_compact=matches[['id','season','date','winner']]