Created
March 21, 2017 23:07
-
-
Save techedlaksh/9001039bf54ba9d8aec3ad7f5d8bfd08 to your computer and use it in GitHub Desktop.
Converting mat files to csv using python, scipy and pandas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scipy.io | |
import pandas as pd | |
mat = scipy.io.loadmat('file.mat') | |
mat = {k:v for k, v in mat.items() if k[0] != '_'} | |
data = pd.DataFrame({k: pd.Series(v[0]) for k, v in mat.iteritems()}) | |
data.to_csv("example.csv") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That's what I said.