Skip to content

Instantly share code, notes, and snippets.

@marcosan93
Last active June 8, 2024 17:06
Show Gist options
  • Select an option

  • Save marcosan93/d2723710932b9d52b6c0dceda2a8dd96 to your computer and use it in GitHub Desktop.

Select an option

Save marcosan93/d2723710932b9d52b6c0dceda2a8dd96 to your computer and use it in GitHub Desktop.
import pandas as pd
# Creating a simple dictionary to start the values
vals = {'2': 1, '3': 1, '4': 1, '5': 1, '6': 1,
'7': 0, '8': 0, '9': 0, '10': -1, 'J': -1,
'Q': -1, 'K': -1, 'A': -1, 'A.': -1}
# Converting to a DataFrame
df = pd.DataFrame(vals, index=[0])
# Adding in values to each row in the DF
df.loc[len(df), :] = [0,1,1,1,1,0,0,0,-1,-1,-1,-1,0,0]
df.loc[len(df), :] = [1,1,2,2,1,1,0,0,-2,-2,-2,-2,0,0]
df.loc[len(df), :] = [1,1,1,1,1,1,0,0,-1,-1,-1,-1,-1,-1]
df.loc[len(df), :] = [1,1,2,2,2,1,0,-1,-2,-2,-2,-2,0,0]
df.loc[len(df), :] = [1,1,1,1,1,0,0,0,-1,-1,-1,-1,-1,-1]
df.loc[len(df), :] = [.5,1,1,1.5,1,.5,0,-.5,-1,-1,-1,-1,-1,-1]
df.loc[len(df), :] = [1,1,2,2,2,1,0,0,-2,-2,-2,-2,-1,-1]
df.loc[len(df), :] = [0,0,0,0,0,0,0,0,0,0,0,0,0,0]
# Renaming the index for each row
df.rename({0: 'Hi-Lo',
1: 'Hi-Opt I',
2: 'Hi-Opt II',
3: 'KO',
4: 'Omega II',
5: 'Red 7',
6: 'Halves',
7: 'Zen Count',
8: 'No Strategy'}, inplace=True)
# Pickling the DataFrame for use later on
df.to_pickle('Card_Counting_Values')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment