I have a dataframe with the shape of (5, 7). The column and row index are named from 0~6and 0~4 respectively. This dataframe (Matrix) consists of only four values such as 5,7,8 and 9.
However there are 6 seven values 6 eight values 7 nine values and 16 five values.
Can anyone suggest a code that can extract the number sevens (7), values of column and row??
For example, 1st seven (2, 1)-->(column name, row index) 2nd seven (2, 2)
and do this for eights and nines and etc.
import numpy as np
import pandas as pd
arr = np.array([[5,7,7,8,8,9,5],
[5,5,8,9,8,5,7],
[5,5,7,9,9,5,5],
[5,5,5,9,8,7,5],
[5,9,9,8,7,5,5]])
df = pd.DataFrame(arr)