I have data set like this:
Team First Season Sec Season Third Season Total Games 0 Dallas Cowboys 1960 222 1245 694 1 Chicago Bears 1920 456 1665 657 2 Green Bay Packers 1921 1123 876 1339 3 Miami Dolphins 1966 1456 445 792 4 Baltimore Ravens 12 1123 232 326 5 San Franciso 49ers 1950 332 123 1003 I want to make column for first/sec and third season as 0 if total games < 700.
This is what I am doing:
col = ['First Season', 'Sec Season', 'Third Season'] df[df['Total Games']<700, col] = 0.0 This throws error why?
https://stackoverflow.com/questions/67293625/pandas-alter-columns-based-on-condition April 28, 2021 at 12:05PM
没有评论:
发表评论