Skip to main content

Posts

Showing posts from March, 2019

Poker Analysis using Python (numpy and pandas)

In this I did an analysis on poker. I made my own dataset by randomly selecting 7 cards from the dataset. It does not gives the actual results. It is more of a simulation of actual data. I have used jupyter-notebook for this you can use any IDE according to your liking. Start by importing the modules. import pandas as pd import numpy as np import random import time Then I created a function calculate_hand which takes hand as a list and returns a boolean list with the corresponding values [royal_flush, straight_flush, four_of_a_kind, full_house, flush, straight, three_of_a_kind, two_pairs, pair, highcard] . If the hand has three cards of same value three_of_a_kind will be True , also pair will be True because if a hand has three of a kind, it also has a pair. Highcard always return the high card. ALL_CARDS_NUM = {'2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9, 'T': 10, 'J': ...