Edit page in Livemark
(2022-09-19 18:33)

Local Scheme

You can read and write files locally with Frictionless. This is a basic functionality of Frictionless.

Reading Data

You can read using Package/Resource, for example:

from pprint import pprint
from frictionless import Resource

resource = Resource(path='table.csv')
[{'id': 1, 'name': 'english'}, {'id': 2, 'name': '中国人'}]

Writing Data

A similiar approach can be used for writing:

from frictionless import Resource

source = Resource(data=[['id', 'name'], [1, 'english'], [2, 'german']])
target = source.write('table-output.csv')
{'name': 'table-output',
 'type': 'table',
 'path': 'table-output.csv',
 'scheme': 'file',
 'format': 'csv',
 'mediatype': 'text/csv'}
| id | name      |
|  1 | 'english' |
|  2 | 'german'  |
It's a beta version of Frictionless Framework (v5). Read Frictionless Framework (v4) docs for a version that is currently installed by default by pip.