sksurv.io.loadarff#

sksurv.io.loadarff(filename)[source]#

Load ARFF file.

Parameters:

filename (str or file-like) – Path to ARFF file, or file-like object to read from.

Returns:

data_frame – DataFrame containing data of ARFF file

Return type:

pandas.DataFrame

See also

scipy.io.arff.loadarff

The underlying function that reads the ARFF file.

Examples

>>> from io import StringIO
>>> from sksurv.io import loadarff
>>>
>>> # Create a dummy ARFF file
>>> arff_content = '''
... @relation test_data
... @attribute feature1 numeric
... @attribute feature2 numeric
... @attribute class {A,B,C}
... @data
... 1.0,2.0,A
... 3.0,4.0,B
... 5.0,6.0,C
... '''
>>>
>>> # Load the ARFF file
>>> with StringIO(arff_content) as f:
...     data = loadarff(f)
>>>
>>> print(data)
  class  feature1  feature2
0     A       1.0       2.0
1     B       3.0       4.0
2     C       5.0       6.0