mirror of
https://github.com/metafy-social/python-scripts.git
synced 2025-02-20 07:12:05 +00:00
Merge pull request #67 from muratonuryildirim/master
Issue No:57 .arff to .csv/.xlsx converter
This commit is contained in:
commit
d4f12d5e62
9
scripts/arff_converter/readme.md
Normal file
9
scripts/arff_converter/readme.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
# ARFF to .CSV and .XLSX
|
||||
This simple script converts .arff files to .csv and .xlsx.
|
||||
|
||||
## Usage
|
||||
|
||||
* Dependency:
|
||||
* scipy
|
||||
* pandas
|
||||
* Use `pip install pandas` and `python -m pip install scipy`
|
14
scripts/arff_converter/script.py
Normal file
14
scripts/arff_converter/script.py
Normal file
|
@ -0,0 +1,14 @@
|
|||
from scipy.io.arff import loadarff
|
||||
import pandas as pd
|
||||
|
||||
|
||||
def arff_to_csv(data, out_file_name):
|
||||
|
||||
df = pd.DataFrame(loadarff(data)[0])
|
||||
df.to_csv(out_file_name, index=False)
|
||||
|
||||
|
||||
def arff_to_excel(data, out_file_name):
|
||||
|
||||
df = pd.DataFrame(loadarff(data)[0])
|
||||
df.to_excel(out_file_name, index=False)
|
Loading…
Reference in New Issue
Block a user