Hello everyone, Given a dataframe like this:
2 6 8 5 I want to yield the following list of lists: [ [[2],[6,5]], [[2],[6]], [[2],[5]], [[8],[6,5]], [[8],[6]], [[8],[5]], [[6],[2,8]], [[6],[8]], [[6],[2]], [[5],[2,8]], [[5],[2]], [[5],[8]], [[6,5],[2,8]] ] I have written the following (which doesn't yield the expected results) import pandas as pd > from itertools import combinations > import numpy as np > resList=[] > resListTmp=[] > resListTmp2=[] > dataframe = > pd.read_excel("C:\\Users\\user\\Desktop\\testData.xlsx",index_col=False,header=None) for i in range(0, len(dataframe)+1): > for j in range(0, len(dataframe.columns)): > for k in range (0,len(dataframe)+1): > for xVals in list(combinations(dataframe.iloc[k:i,j], i)): > if list(xVals) not in resListTmp: > resListTmp.append(list(xVals)) > resListTmp2.append(resListTmp) > resList.append(resListTmp2) > print(resList) > What is wrong with my code?
_______________________________________________ NumPy-Discussion mailing list -- numpy-discussion@python.org To unsubscribe send an email to numpy-discussion-le...@python.org https://mail.python.org/mailman3/lists/numpy-discussion.python.org/ Member address: arch...@mail-archive.com