
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
This project provides file format handler packages for JSON, CSV, XML, and Excel files. The packages provide an abstraction layer to load and save data in these file formats using a unified API.
To install the package, use pip: pip install echoss_fileformat
To upgrade the installed package, use pip: pip install echoss_fileformat -U
from echoss_fileformat import FileUtil, to_table, get_logger, set_logger_level
# FileUtil Load test_data from a file
csv_df = FileUtil.load('test_data.csv')
excel_df = FileUtil.load('weather_data.xls')
json_df = FileUtil.load('test_data.json', data_key = 'data')
jsonl_df = FileUtil.load('test_multiline_json.jsonl', data_key = 'data')
# FileUtil Save DataFrame to a file
FileUtil.dump(excel_df, 'save/test_data_1.csv')
FileUtil.dump(csv_df, 'weather_data.xlsx')
FileUtil.dump(json_df, 'test_data_2.jsonl')
# read/write config file
app_config = FileUtil.dict_load('config/application.yaml')
db_config = FileUtil.dict_load('jdbc.properties')
FileUtil.dict_dump(app_config, 'new_config.xml')
# DataFrame to table-like string
logger = get_logger("echoss_fileformat_test")
set_logger_level("DEBUG")
logger.debug(to_table(json_df))
ํ์ผ ํฌ๋งท ์ฝ๊ธฐ :
ํ์ผ ํฌ๋งท ์ฐ๊ธฐ :
For config file load/dump:
dict_load() : load file format to dictionary for configuration files .yaml, .xml, .json and .properties dict_dump() : write dictionary to file format .yaml, .xml, .json and .properties
For print dataframe:
def to_table(df: pd.DataFrame, index=True, max_cols=16, max_rows=10, col_space=4, max_colwidth=24): dataframe to table-like string
exampe:
+--------------------------+----------------+----------------+---------------+--------------------+------------------+-----------------+-----------------+
| ('์์งํญ๋ชฉ', '๊ฐ์ฒด๋ฒํธ') | ('๊ณผํญ', 'cm') | ('๊ณผ๊ณ ', 'cm') | ('๊ณผ์ค', 'g') | ('๋น๋', 'Brix %') | ('์ฐ๋', '0-14') | ('๊ฒฝ๋', 'kgf') | ('์๋ถ์จ', '%') |
+--------------------------+----------------+----------------+---------------+--------------------+------------------+-----------------+-----------------+
| 1 | 8.2 | 6.6 | 253 | 3.1 | 4.0 | 2.71 | 71.2 |
+--------------------------+----------------+----------------+---------------+--------------------+------------------+-----------------+-----------------+
| 2 | 6.3 | 5.7 | 136 | 3.1 | 4.0 | 2.74 | 72.2 |
+--------------------------+----------------+----------------+---------------+--------------------+------------------+-----------------+-----------------+
| 3 | 8.0 | 6.3 | 220 | 3.4 | 4.5 | 2.71 | 70.4 |
+--------------------------+----------------+----------------+---------------+--------------------+------------------+-----------------+-----------------+
| 4 | 7.3 | 6.0 | 173 | 3.7 | 4.0 | 2.75 | 73.78 |
+--------------------------+----------------+----------------+---------------+--------------------+------------------+-----------------+-----------------+
| 5 | 6.3 | 5.5 | 130 | 3.6 | 4.0 | 2.72 | 75.4 |
+--------------------------+----------------+----------------+---------------+--------------------+------------------+-----------------+-----------------+
handler = CsvHandler('object')
handler = ExcelHandler() ๋๋ handler = ExcelHandler('array')
handler = JsonHandler('multiline')
The package provides an abstraction layer to load and save data in JSON, CSV, XML, and Excel formats. The API includes the following methods:
load(file_or_filename, **kwargs)
: Load data from a file.loads(bytes_or_str, **kwargs)
: Load data from a string.dump(file_or_filename, data = None, **kwargs)
: Save data to a file.dumps(data = None, **kwargs)
: Save data to a string.The following example demonstrates how to load data from a CSV file and save it as a JSON file:
from echoss_fileformat import CsvHandler, JsonHandler
# Load test_data from a CSV file
csv_handler = CsvHandler()
data = csv_handler.load('test_data.csv', header=[0, 1])
# Save test_data as a JSON file
json_handler = JsonHandler('array')
json_handler.load( 'test_data_1.json', data_key = 'data')
json_handler.load( 'test_data_2.json', data_key = 'data')
json_handler.dump( 'test_data_all.json')
Contributions are welcome! If you find a bug or want to suggest a new feature, please open an issue on the GitHub repository.
This project is licensed under the LGPL License. See the LICENSE file for more information.
This project was created by 12cm. Special thanks to 12cm R&D for their contributions to the project.
FAQs
File format handler packages for JSON, CSV, XML, and Excel files
We found that echoss-fileformat demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.ย It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.