mirror of
https://github.com/rzmk/czv.git
synced 2025-12-19 08:09:24 +00:00
- Add relevant links to all READMEs and source code - Resolve clippy lints czv: - Add more docs for top-level items - Add suggestion to use builder methods instead of functions - Disable slice and slice tests until operation is complete czv-wasm: - Use tsify_next for allowing objects as parameters - Add nodejs example and instructions
51 lines
1.4 KiB
Python
51 lines
1.4 KiB
Python
"""
|
|
# czv
|
|
|
|
Python library for [czv](https://github.com/rzmk/czv). CSV operations library for data engineering/analysis tasks.
|
|
|
|
## Install
|
|
|
|
```bash
|
|
pip install czv
|
|
```
|
|
|
|
## Example
|
|
|
|
```python
|
|
from czv import row_count
|
|
|
|
output = row_count(file_path="fruits.csv")
|
|
|
|
print(output)
|
|
```
|
|
|
|
## Links
|
|
|
|
- czv GitHub repository: <https://github.com/rzmk/czv>
|
|
- Rust: [crates.io/crates/czv](https://crates.io/crates/czv) ([source code](https://github.com/rzmk/czv/tree/main/czv))
|
|
- WebAssembly (JavaScript/TypeScript): [npmjs.com/package/czv](https://www.npmjs.com/package/czv) ([source code](https://github.com/rzmk/czv/tree/main/czv-wasm))
|
|
- Python: [pypi.org/project/czv](https://pypi.org/project/czv/) ([source code](https://github.com/rzmk/czv/tree/main/czv-python))
|
|
|
|
"""
|
|
|
|
from typing import Optional
|
|
from pathlib import Path
|
|
|
|
def row_count(file_path: Optional[Path], file_data: Optional[str], include_header_row: Optional[bool]) -> int:
|
|
"""Returns a count of the total number of rows.
|
|
|
|
## Arguments
|
|
|
|
* `file_path` - CSV file path.
|
|
* `file_data` - CSV file data.
|
|
* `include_header_row` - Specify whether to include the header row (first row) in the row count. Default is false.
|
|
"""
|
|
|
|
def column_count(file_path: Optional[Path], file_data: Optional[str]) -> int:
|
|
"""Returns a count of the total number of columns (fields).
|
|
|
|
## Arguments
|
|
|
|
* `file_path` - CSV file path.
|
|
* `file_data` - CSV file data.
|
|
"""
|