Page 4 of 5

Re: Hand History Parser for obtaining Player Stats

Posted: Fri Jul 24, 2020 4:50 am
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.

Re: Hand History Parser for obtaining Player Stats

Posted: Fri Jul 24, 2020 6:18 am
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.

Re: Hand History Parser for obtaining Player Stats

Posted: Fri Jul 24, 2020 1:17 pm
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)

Re: Hand History Parser for obtaining Player Stats

Posted: Mon Dec 21, 2020 12:46 pm
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.

Re: Hand History Parser for obtaining Player Stats

Posted: Tue Feb 16, 2021 2:31 pm
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!

Re: Hand History Parser for obtaining Player Stats

Posted: Wed Feb 17, 2021 7:59 am
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

Re: Hand History Parser for obtaining Player Stats

Posted: Mon Apr 05, 2021 1:41 pm
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

Re: Hand History Parser for obtaining Player Stats

Posted: Mon Apr 12, 2021 8:59 am
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?

Re: Hand History Parser for obtaining Player Stats

Posted: Mon Apr 12, 2021 2:18 pm
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

Re: Hand History Parser for obtaining Player Stats

Posted: Mon Apr 12, 2021 2:19 pm
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