Skip to content

Instantly share code, notes, and snippets.

@bussiere
Created April 19, 2018 15:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bussiere/7cbc7cd2668c381264e8434b01b5062e to your computer and use it in GitHub Desktop.
Save bussiere/7cbc7cd2668c381264e8434b01b5062e to your computer and use it in GitHub Desktop.
combinations.py
from itertools import combinations
import numpy as np
import pandas as pd
dates = pd.date_range('20130101',periods=40)
df = pd.DataFrame(np.random.randn(40,20),index=dates,columns=list('ABCDEFGHIJKLMNOPQRST'))
#df = df.set_index('0')
print(df.head())
cc = []
i = 1
while i < len(df.columns)+1 :
cc = cc + list(combinations(df.columns,i))
i = i + 1
print(cc)
print(len(cc))
#print(df)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment