From 65513f33fced4b8e0d0d74fc2d71e3f08d970b89 Mon Sep 17 00:00:00 2001 From: ahmethakanbesel Date: Tue, 3 Oct 2023 14:50:04 +0300 Subject: [PATCH] docs: add pandas example --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index e9b0e29..dd23386 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,20 @@ Default email is `admin@example.com` and password is `1234567890`. http://127.0.0.1:8090/api/yahoo/symbol/THYAO.IS?startDate=2023-06-01&endDate=2023-09-30¤cy=TRY ``` +### Use with Pandas + +```python +import pandas as pd + +API_URL = 'http://127.0.0.1:8090' + +def get_data(symbol, start_date, end_date): + url = f'{API_URL}/api/yahoo/symbol/{symbol}?startDate={start_date}&endDate={end_date}&format=csv' + df = pd.read_csv(url, parse_dates=['Date']) + df.set_index('Date', inplace=True) + return df +``` + ## Credits - [Pocketbase](https://github.com/pocketbase/pocketbase)