From 9121176bf51bbbc272e4474fff1dbc489e7c41ec Mon Sep 17 00:00:00 2001 From: Florent Ravenel Date: Thu, 21 Dec 2023 10:13:04 +0100 Subject: [PATCH] fix: get current transactions --- ...aas_Credits_Get_current_transactions.ipynb | 41 ++++--------------- 1 file changed, 9 insertions(+), 32 deletions(-) rename Naas/Naas_Get_Transactions.ipynb => Naas Credits/Naas_Credits_Get_current_transactions.ipynb (88%) diff --git a/Naas/Naas_Get_Transactions.ipynb b/Naas Credits/Naas_Credits_Get_current_transactions.ipynb similarity index 88% rename from Naas/Naas_Get_Transactions.ipynb rename to Naas Credits/Naas_Credits_Get_current_transactions.ipynb index c8186865bd..824a48f547 100644 --- a/Naas/Naas_Get_Transactions.ipynb +++ b/Naas Credits/Naas_Credits_Get_current_transactions.ipynb @@ -26,7 +26,7 @@ "tags": [] }, "source": [ - "# Naas - Get Transactions\n", + "# Naas Credits - Get Transactions\n", "

Give Feedback | Bug report" ] }, @@ -60,7 +60,7 @@ "tags": [] }, "source": [ - "**Last update:** 2023-04-12 (Created: 2021-11-17)" + "**Last update:** 2023-12-21 (Created: 2021-11-17)" ] }, { @@ -112,30 +112,6 @@ "import pandas as pd" ] }, - { - "cell_type": "markdown", - "id": "306bd842-b936-4eed-a173-f49dfdd09687", - "metadata": { - "papermill": {}, - "tags": [] - }, - "source": [ - "### Variables" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "782b2a2b-ca0b-45e1-823f-c3abf3ac43cf", - "metadata": { - "papermill": {}, - "tags": [] - }, - "outputs": [], - "source": [ - "page_size = \"100000\"" - ] - }, { "cell_type": "markdown", "id": "registered-showcase", @@ -155,7 +131,7 @@ "tags": [] }, "source": [ - "### Function" + "### Get transactions" ] }, { @@ -168,8 +144,9 @@ }, "outputs": [], "source": [ - "df = pd.DataFrame(naascredits.connect().transactions.get(page_size=page_size))\n", - "df" + "df = pd.DataFrame(naascredits.connect().transactions.get_currents())\n", + "print(len(df))\n", + "print(\"Current balance:\", df.CREDIT.sum())" ] }, { @@ -211,7 +188,7 @@ }, "outputs": [], "source": [ - "df.to_csv(\"billing.csv\")" + "df" ] } ], @@ -231,7 +208,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.8" + "version": "3.9.6" }, "naas": { "notebook_id": "5df9412ae66fd7ab475df0c83cd5f8a2f36ca695bb4292dd5433aded3dc2e890", @@ -253,4 +230,4 @@ }, "nbformat": 4, "nbformat_minor": 5 -} \ No newline at end of file +}