Skip to main content

Build Status PyPI version

Goal

This is a package which converts files to different types.

Supported extensions

  • CSV
  • ARFF

Installation

pip install filepy --upgrade

Usage

This library is mainly divided into 2 ideas, namely writers and readers. Readers will read your files, writer will write in appropriate format.

Available classes:

  • CsvReader
  • CsvWriter
  • ArffReader
  • ArffWriter

Suppose that you have a csv file: example1.csv.

You want to convert this file to an arff format for instance converted.arff

from filepy.csv_reader import CsvReader
from filepy.arff_writer import ArffWriter
from filepy.file_converter import convert

csv_reader = CsvReader('example1.csv', delimiter=';')
arff_writer = ArffWriter('converted.arff', delimiter=',')

convert(input_reader=csv_reader, output_writer=arff_writer)

Additional options

Each writer and reader has additional options to use.

CsvReader

CsvReader(path_to_file, delimiter = ',', first_line_column_names = True, skip_first_column = False)

delimiter - how data is separated, can be regex
first_line_column_names - uses first line to read columns
skip_first_column - skips first column of data 

After creating object you can get data from it.

csv_reader = CsvReader('your/path/to/file')
data = csv_reader.dto.data
column_names = csv_reader.dto.data

CsvWriter

CsvWriter(path_to_file, delimiter = ',', skip_writing_columns = False)

delimiter - how data will be separated in generated file
skip_writing_column - whether first line in generated file should have columns names

ArffReader

ArffReader(path_to_file, delimiter = ',')

delimiter - how data is separated, can be regex

After creating object you can get data from it.

csv_reader = CsvReader('your/path/to/file')
data = csv_reader.dto.data
column_names = csv_reader.dto.columns

ArffWriter

ArffWriter(path_to_file, delimiter= ',')

delimiter - how data will be separated in generated file

Metadata

Release files for filepy 0.17

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for filepy 0.17
File Interpreter ABI Platform
filepy-0.17-py3-none-any.whl Python 3 none any Details

Release files / filepy-0.17-py3-none-any.whl

Download URL filepy-0.17-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
951d998bbd7324393c3d00700091ca34da49742971f111e27cd25554f8bfd9e5
BLAKE2b-256 checksum
How to use checksums
cf870e2f59cd0d896701b4ccd5198dc98792a2e200c1074012466ce7fc8a8cbb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

Release history Release notifications | RSS feed

This release

0.17 This release

1 release file

0.16

1 release file

0.15

1 release file

0.14

1 release file

0.13

1 release file

0.12

1 release file

0.11

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page