|
- from sas7bdat import SAS7BDAT
-
- with SAS7BDAT("Downloads/accepts.sas7bdat") as f:
- lst = map(lambda x: dict(zip(f.column_names, x)), [i for i in f][1:])
-
- col = ["app_id", "bureau_score", "ltv", "tot_derog", "tot_income", "bad"]
-
- for i in range(5):
- print {k: lst[i].get(k) for k in col}
-
- #{'tot_income': 4800.0, 'ltv': 109.0, 'app_id': 1001.0, 'bureau_score': 747.0, 'bad': 0.0, 'tot_derog': 6.0}
- #{'tot_income': 5833.33, 'ltv': 97.0, 'app_id': 1002.0, 'bureau_score': 744.0, 'bad': 0.0, 'tot_derog': 0.0}
- #{'tot_income': 2308.33, 'ltv': 105.0, 'app_id': 1003.0, 'bureau_score': 667.0, 'bad': 0.0, 'tot_derog': 0.0}
- #{'tot_income': 4083.33, 'ltv': 78.0, 'app_id': 1005.0, 'bureau_score': 648.0, 'bad': 1.0, 'tot_derog': 2.0}
- #{'tot_income': 5783.33, 'ltv': 100.0, 'app_id': 1006.0, 'bureau_score': 649.0, 'bad': 0.0, 'tot_derog': 2.0}
复制代码 |
|