python - Import Excel to numpy to solve linear equations -


i have 2 matrices in 2 excel files. 57x56 (first row labels) , b 57x1. i'm trying find solution ax=b using python.

what did:

import numpy np import pandas pd a=pd.read_excel("56x56.xlsx") b=pd.read_excel("56x1.xlsx") a=np.matrix(a) b=np.matrix(b) x = np.linalg.solve(a, b) 

this gives me error "float() argument must string or number". wonder if because first label-row in a. if solution?

thanks!

without further knowledge can guess. first row treated header. try:

a=pd.read_excel("56x56.xlsx",sheet='sheet1',header = none) 

furthermore data should array. therfore a = a.values should unless explicitly convert e.g a = np.array(a.values,dtype=float)


Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -