macxred / cashctrl_api

Python client for the CashCtrl REST API
MIT License
0 stars 0 forks source link

Enforce Data Frame Schema #22

Closed lasuk closed 3 months ago

lasuk commented 3 months ago

Enforce DataFrame Schema

Scope

Background

Converting the results of a GET request from '../list.json' to pd.DataFrame returns a reliable DataFrame only when the list is non-empty. If the list is empty, it results in a DataFrame with no columns, which can cause downstream errors.

cc_client = CashCtrlClient()
df = pd.DataFrame(cc_client.get('journal/list.json')['data'])

Refer to the Type Consistency section in the CONTRIBUTING.md for more details.

lasuk commented 3 months ago

Here's a review by ChatGPT:

Click for instructions given to ChatGPT ``` > Review this Python unit and the corresponding unit test. [Uploaded enforce_dtypes.py and test_enforce_dtypes.py] > Provide as downloadable markdown file ```

enforce_dtypes.py Review

Functionality

Error Handling

Type Conversion Specifics

Code Structure

Documentation and Examples

test_enforce_dtypes.py Review

Test Cases

Coverage and Robustness

Improvement Suggestions

lasuk commented 3 months ago

Implements first step in macxred/cashctrl_ledger#2.