Hand History Parser for obtaining Player Stats

Add your suggestions for improving Poker Mavens
Tsiphon
Posts: 21
Joined: Thu Apr 09, 2020 7:36 pm

Re: Hand History Parser for obtaining Player Stats

Post by Tsiphon »

To be a complete idiot, is this a hand history analyzer? Like...plug in the text file data and get shown VPIP, 3b, limp%, that kind of thing? Or is it simply collecting buy in, add on, and leave the table data (basically looking at each player's net for a given session). I've never ran Python before.
cchervit
Posts: 35
Joined: Sat Mar 14, 2020 11:18 pm

Re: Hand History Parser for obtaining Player Stats

Post by cchervit »

Tsiphon wrote:To be a complete idiot, is this a hand history analyzer? Like...plug in the text file data and get shown VPIP, 3b, limp%, that kind of thing? Or is it simply collecting buy in, add on, and leave the table data (basically looking at each player's net for a given session). I've never ran Python before.
It’s the latter...gives net balance info per player and creates a log of all chip events. Does not do hand stat analysis.
napeednus
Posts: 1
Joined: Fri Jul 24, 2020 1:06 pm

Re: Hand History Parser for obtaining Player Stats

Post by napeednus »

This was useful for me, so in case it works for anyone else...

Using StevieG's latest code on github, I wrote a simple python function that takes his `hand` dictionary and calculates the pnl for each hand for the player of your choosing. This is useful if you want to review specific hands from a session.

Code: Select all

def get_hands_pnl(player_name, hands):
	'''
	Input is a player name string and a dictionary of hands
	Output is a pandas dataframe with hand numbers and pnl
	'''

	import pandas as pd
	
	hands_pnl_df = pd.DataFrame()
	
	### Loop through each hand
	for hand_number in hands.keys():
		hand_text = hands[hand_number]['text']
		dollars_list = re.findall('\((.*?)\)', hand_text)
		player_winners = re.findall('\n(.*?) wins Pot', hand_text)
		if len(player_winners) < 1:
			player_winners = re.findall('\n(.*?) splits Pot', hand_text)
		pot_amount = float(dollars_list[-2]) / len(player_winners)
		
		### Try to match player_name with players who invested money into the pot
		players_outlay_str = dollars_list[-1]
		try:
			my_outlay = float(re.findall(player_name + '\: (.*?)\,', players_outlay_str + ',')[0])
		except:
			my_outlay = 0
		my_pnl = int(player_name in player_winners)*pot_amount - my_outlay
		hand_pnl_df = pd.DataFrame({'hand_number': hand_number, 'pnl': my_pnl}, index = [0])
		hands_pnl_df = pd.concat([hands_pnl_df, hand_pnl_df], ignore_index = True)
	
	return hands_pnl_df.sort_values('pnl', ascending = False)
StevieG
Posts: 56
Joined: Mon May 04, 2020 12:27 pm

Re: Hand History Parser for obtaining Player Stats

Post by StevieG »

Quick note - I have added initial support for TR files.

So if you have a set of Hand History files, and you also want to add in Tournament results for a consistent, uniform listing of funds in and funds out, you can do that now.
bclimb1983
Posts: 9
Joined: Sat Apr 11, 2020 10:31 am

Re: Hand History Parser for obtaining Player Stats

Post by bclimb1983 »

Any chance there is a high level "How To" to use this? I'm not familiar with running Python.

I've downloaded Python3 and installed on my server but not sure what to do next.

Thanks in advance!
StevieG
Posts: 56
Joined: Mon May 04, 2020 12:27 pm

Re: Hand History Parser for obtaining Player Stats

Post by StevieG »

bclimb1983 wrote:Any chance there is a high level "How To" to use this? I'm not familiar with running Python.
Good idea.

I just wrote a beginner's guide to help: https://github.com/yellowtongue/process ... er's-Guide
setspike
Posts: 100
Joined: Fri Apr 03, 2020 6:32 pm

Re: Hand History Parser for obtaining Player Stats

Post by setspike »

StevieG - amazing work. This is awesome in getting total chip plus/minus stats for folks in Ring Games based on Hand History logs.

Feature request: something similar that works against the EventLog logs in order to get balance plus/minus stats for both Ring Games and Tournaments in a combined view.

Thanks again.

- setspike
StevieG
Posts: 56
Joined: Mon May 04, 2020 12:27 pm

Re: Hand History Parser for obtaining Player Stats

Post by StevieG »

Thanks for the kind words, setspike.

Could you expand on the request?

I recently did make an update that allows you to process Tournament Results files. So you should be able to run those as well as Hand History files.

Note: There may be an issue with TR files where a player was removed (I think the script stil considers the user to have paid in, although Mavens acually refunds the buy in).

Is there something else in the EventLogs that you want to capture?
setspike
Posts: 100
Joined: Fri Apr 03, 2020 6:32 pm

Re: Hand History Parser for obtaining Player Stats

Post by setspike »

Hi StevieG,

When I run the script against multiple Hand History files consisting of both ring game and tournaments, tournament chips and ring game chips are treated the same thus giving an inaccurate representation of plus/minus.

Hope this makes sense.

- setspike
setspike
Posts: 100
Joined: Fri Apr 03, 2020 6:32 pm

Re: Hand History Parser for obtaining Player Stats

Post by setspike »

Would love a python script that worked against EventLog files that tracked money in and money out for both ring games and tournament games.

Thanks.

- setspike
Post Reply