Loading .arff type files in python

python
arff

#1

Hello.

I am currently working on a problem which involves a file which is in “.arff” format. So how can I load this file into my jupyter notebook as a pandas dataframe.

Here is the link to download the file.
yeast-train.arff.zip (521.9 KB)


#2

Hey @shubham.jain, This worked for me -

from scipy.io import arff
import pandas as pd

data = arff.loadarff('yeast-train.arff')
df = pd.DataFrame(data[0])

df.head()

.arff type files are used for weka. Luckily, Scipy has a module that can read .arff file and convert that to numpy array. From there we can convert it to a data frame.

Note You first need to extract the zip file.

Hope this helps.

Sanad :slight_smile:


#3

Thanks @mohdsanadzakirizvi. :slight_smile: