Created
May 24, 2016 14:16
-
-
Save metasyn/71efb87d86190bcfb5dbfd6dd345b86f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import splunk.Intersplunk | |
| import exec_anaconda | |
| try: | |
| exec_anaconda.exec_anaconda() | |
| except Exception as e: | |
| import cexc | |
| cexc.abort(e) | |
| sys.exit(1) | |
| import sys | |
| import csv | |
| import pandas as pd | |
| items = [] | |
| # read results | |
| results = splunk.Intersplunk.readResults() | |
| # normal dictionary, not ordered | |
| d = [dict(r) for r in results] | |
| df = pd.DataFrame(d, dtype='float') | |
| c = df.corr() | |
| output = c.to_dict('records') | |
| for i, col in enumerate(c.columns): | |
| output[i]['field'] = col | |
| splunk.Intersplunk.outputResults(output) | |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
not so good because i had to loop back through to undo the ordered dictionary that splunk provides... there is probably a better way !