title: How can I pass the AttributeError: 'DataFrame' object has no attribute 'flatten in Python?
body: <p>I have used python to create spatial Markov matrix but I got this error (AttributeError: 'DataFrame' object has no attribute 'flatten' ). I am not familiar with python so, I hope to help me to solve this problem?
  the codes is </p>
  
  <pre><code>import numpy as np
  import pysal`enter code here`
  import pandas as pd
  import pysal as ps
  
  f = pd.read_csv("C:\\Users\\Yousif\\Desktop\\Spatial.MC\\updated_testdata1-36-Copy.csv")
  f
  
  pci = f[list(map(str,range(1, 1096)))]
  
  #f = ps.open(ps.examples.get_path("usjoin36.csv"))
  #f
  #pci = np.array([f.by_col[str(y)] for y in range(1,1096)])
  
  pci = pci.transpose()
  rpci = pci/(pci.mean(axis=0))
  
  #w = ps.open(ps.examples.get_path("states36.gal")).read()
  
  w = ps.open("C:/Users/Yousif/Desktop/Spatial.MC/states-36-Copy.gal").read( )
  
  w.transform = 'r'
  
  sm = ps.Spatial_Markov(rpci, w, fixed=True, k=5, variable_name='rpci')
  for p in sm.P:
      print(p)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/ssB5F.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ssB5F.png" alt="enter image description here"></a></p>