jeudi 4 avril 2019

Column value based on matches across2 dataframes and subsequent search in second dataframe

I'm trying to using retrosheet game data and pitchfx pitch and atbat data assign the catcher for every given pitch from 2008 until now because of some subsequent research. I'm having trouble doing this but have cleaned and gotten the data to a place where I think a match is possible. My plan is to use the retrosheet data to set the starting catcher for each team and then use the pitchfx action data to make the substitutions when necessary once games are underway.

My plan is to using the date and starting home pitcher of a team in the pitchfx data match that to the starting home pitcher and date in the retrosheet data and then search the starting batting order for the one in defensive position 2 (the catcher) and then list them as the catcher for that entire game in the pitchfx data based then on the gameday link I can figure out once I've set that catcher as the one for the starting pitcher for the top of the inning and then find the opposing starting catcher also from the opposing lineup in retrosheet and have them be the catcher for their team during the course of the game.

I then separately have pitchfx action data which I can use to name the catcher for any given team from their substitution onwards but not as a starter.

The retro columns I'll be using are the date, home starter, and then each lineup spot has the hitter and then in a separate column their position so VisBat1 is the visiting leadoff hitter, VisBat1Pos is their defensive position -- I need to search all nine and save only the name of the one who's position is 2 and have that name printed in my atbat dataframe as the catcher.

Aucun commentaire:

Enregistrer un commentaire