CSV to Adjacent matrix - adjacency-matrix

I have a csv file with with 25 rows and 25 columns . the first row and columns are the headings. How do i plot the adjacent matrix for the given data using python?

Related

Sorting a matrix by its column without affecting the other columns

I want to sort my matrix by each column. The matrix has 200 columns. sorting has to be done one column at a time and the order of the other column should not be affected.
Please help me with this.

Algorithm to find best combination in multi-dimensional array based on certain criteria

I am looking for an algorithm to work out the best combination based on criteria (Best == use the most cells possible and if possible use all cells). The source is always a multi-dimensional array and only consists of 2 different elements. The goal is to use all the elements in the array and elements can only be used once.
As an example :
Input (Multi-Dimensional array) :
AAAAA
ABBBA
AAAAA
Where the first items position is 0,0
Criteria :
Every combination must contain at least one A and at least one B.
The maximum number of cells per combination allowed is 6.
The solution for this example is :
Three different combinations that uses every cell from input and does not exceed the maximum number of cells per combination that is 6
AA A AA
AB B BA
AA A AA
The first combination is between rows 0,2 and columns 0,1
The second combination is between rows 0,2 and columns 2,2
The third combination is between rows 0,2 and columns 3,4
A more real life example would be
ABBBAAA
BBBBABB
AABAABA
ABBABBB
AAAAAAB
AAAAAAB
Criteria :
Every combination must contain at least one A and at least one B.
The maximum number of cells per combination allowed is 5.

Average of a section of a column

I have a huge dataset that is broken down into counts per tree. So there are 15 counts made per tree. I need to make an average of counts of egg.scars (column name) within each tree. I don't want an average of the whole column like I keep getting, I need an average egg scar count per tree.
Thanks!
you can extract specific rows of a column by doing eggs[1:5,5] where 5 is your column and 1:5 are the rows from 1 to 5 and eggs your dataframe and then do mean(eggs[1:5,5])

How can I get correct totals in SSRS matrix?

The matrix below has column totals under the red line. The pivoted column group columns are highlighted in yellow to the right of the vertical red line. The columns in the white to the left are not pivoted.
So it looks like the totals under the pivoted yellow columns are correct,
but the totals under the regular columns are totally wrong.
Those are simple =Sum(Fields!columnX.Value) totals in a group total row.
Matrix design is as follows (wherever you see "Expr" it is simply that Sum multiplied by a temporarily used constant 1, except where I deleted that from pour_weight for simplicity):
It appears that SSRS totals the left columns BEFORE pivoting the right columns, which is a total disaster.
What am I doing wrong?
Ended up creating a 2nd dataset without detail columns and with the Sums of each on the remaining columns, then using a Lookup function in the matrix cells to find the correct group's correct total.

Reading files into fortran

So I'm writing some code in Fortran that multiplies a square matrix by itself. But the matrix I have to multiply is in a file and I'm having some issues reading it into the program. I think its because the sample data is in the following format:
3
101
010
101
The first row is the dimension of the matrix, and each row is a now in the matrix, but there aren't spaces in between the entries. So I guess my question is how do I split up those rows as I read them into a 2d array?
Read in the first number as N and use it to allocate an array of dimension N by N. Then read a row at a time of this array: array (i, 1:N)) for i=1 to N. See Fortran: reading a row of numbers into an array for the format to use.
Read using format
read (1,*) n
allocate(A(n,n))
do i=1,n
read (1,'(1000i1)'),A(i,:)
enddo
it does not matter whether you declare extra "i1" than actually needed

Resources