'Convert Arff File to Text Document Format

I am trying to read arff file and convert it to dataframe such that I have text with document number and labels against it. I selected bibtex.arff dataset from mulan library.

import arff
import numpy as np
import pandas as pd

data = arff.load(open('/drive/My Drive/bibtex.arff', 'rb'))
df = pd.DataFrame(data[0])

df.head()

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source