Searching string and return value and other operationsbetween several datasets pandas

  Kiến thức lập trình

I have 4 data frames for example
Dm=

Roll marks grade section
123 56. Fair. A
789 70. Good. A
445 89. Good. C
675 45. Fair b
Db=
Team. Sports. Score
Kings. Baseball. 100
Titans. Rugby. 100
Jags. Basketball 40
Knights cricket. 80
Boys. Hockey. 70
Ds=
Roll. Subject. Marks test
123 Maths. 100. Annual
456 Chem. 89. Term
789 Bio 56 annual
556 Code. 70. Half
Df=
Name. Age. Class
Jay. 15. 8.
Ron. 13. 7
Kelly. 14 8
May. 16. 10.

I need to check if the column dm[‘grade’] is fair the create a dataset having columns and values as

Final= {‘activities’: db[‘sports], ‘student score’: db[‘score’]}
Else if dm[‘grade’] is good then return values as
Final= {‘type’: db[‘team’], ‘student score’: df[‘class’]}
I tried
If dm[‘grade’] is fair:
But not getting correct result

Aslo need to find total of marks and score between Dm an ds.

I also need merge all the data frame into one for easier reach on Roll and Marks but not happening as those are not common in all the dataframes.

I tried with >pandas.concat(,axis=1) but not having perfect output

LEAVE A COMMENT