Skip to content

Commit

Permalink
release: v0.3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
sumeshi authored Nov 22, 2024
1 parent a04530d commit 0489934
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ Loads the specified CSV files.
```
Arguments:
*path: tuple[str]
Options:
separator: str = ','
low_memory: bool = False
```

examples
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "qsv"
version = "0.3.6"
version = "0.3.7"
description = "A tool that provides elastic and rapid filtering for efficient analysis of huge CSV files, such as eventlogs."
readme = "README.md"
authors = [
Expand Down
4 changes: 3 additions & 1 deletion src/qsv/controllers/CsvController.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ class CsvController(object):
def __init__(self, path):
self.path: Path = path

def get_dataframe(self) -> pl.DataFrame:
def get_dataframe(self, separator: str = ',', low_memory: bool = False) -> pl.DataFrame:
df = pl.scan_csv(
self.path,
try_parse_dates=True,
rechunk=True,
truncate_ragged_lines=True,
separator=separator,
low_memory=low_memory,
)
return df
4 changes: 2 additions & 2 deletions src/qsv/controllers/DataFrameController.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ def quilt(self, config: str, *path: tuple[str]) -> None:
getattr(self, k)()

# -- initializer --
def load(self, *path: tuple[str]):
def load(self, *path: tuple[str], separator: str = ',', low_memory: bool = False):
"""[initializer] Loads the specified CSV files."""
logger.debug(f"{len(path)} files are loaded. [{', '.join(path)}]")
self.__check_exists_path(path)
self.df = CsvController(path=path).get_dataframe()
self.df = CsvController(path=path).get_dataframe(separator=separator, low_memory=low_memory)
return self

# -- chainable --
Expand Down

1 comment on commit 0489934

@sumeshi
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#13

Please sign in to comment.