Skip to content

Instantly share code, notes, and snippets.

@Namkolla
Created January 16, 2018 07:02
Show Gist options
  • Save Namkolla/ce89faceea80f387beaed9984f8fba0d to your computer and use it in GitHub Desktop.
Save Namkolla/ce89faceea80f387beaed9984f8fba0d to your computer and use it in GitHub Desktop.
Eigenfactor calculation for citations
I've got data that looks like this:
758, 1476, 5
758, 758, 150
758, 5938, 3
758, 4972, 13
758, 2416, 0
758, 7067, 1
758, 4543, 0
758, 2722, 1
758, 2249, 1
758, 7531, 1
758, 5046, 0
758, 5250, 2
758, 1611, 2
758, 1441, 0
758, 4032, 7
758, 1419, 16
758, 630, 42
758, 6967, 2
758, 3683, 0
758, 6732, 121
...
Pretty long list, it's a 59.4 MB file
I need to get it in the format of an n x n matrix like:
matrix = [ 12 42 54 2 0 ... ]
[ 89 12 43 0 0 ... ]
....
where n = # of unique values in "column 1" of the list (could also use "column 2", should be the same thing)
and then each element comes from "column 3" where it's row i = corresponding column 1 value and row j = corresponding column 2 value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment