Skip to content

Instantly share code, notes, and snippets.

@metasyn
Created May 24, 2016 14:16
Show Gist options
  • Select an option

  • Save metasyn/71efb87d86190bcfb5dbfd6dd345b86f to your computer and use it in GitHub Desktop.

Select an option

Save metasyn/71efb87d86190bcfb5dbfd6dd345b86f to your computer and use it in GitHub Desktop.
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)
@metasyn

metasyn commented May 24, 2016

Copy link
Copy Markdown
Author

not so good because i had to loop back through to undo the ordered dictionary that splunk provides... there is probably a better way !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment