From ff2075e1ae29afec775a932e2d4cc550bf3b7167 Mon Sep 17 00:00:00 2001
From: John-Paul Robinson <jpr@uab.edu>
Date: Tue, 25 Mar 2025 19:35:48 -0500
Subject: [PATCH] Change report date range for power-stats to 2021-06-01 to
 2021-10-20

Additional introspection cells on data frame content.
---
 power-stats.ipynb | 139 +++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 130 insertions(+), 9 deletions(-)

diff --git a/power-stats.ipynb b/power-stats.ipynb
index 60efb68..c2fcf36 100644
--- a/power-stats.ipynb
+++ b/power-stats.ipynb
@@ -86,8 +86,8 @@
    "metadata": {},
    "outputs": [],
    "source": [
-    "startdate = '2021/01/01 00:00:00'\n",
-    "enddate = '2021/04/8 00:00:00'"
+    "startdate = '2021/06/01 00:00:00'\n",
+    "enddate = '2021/10/20 00:00:00'"
    ]
   },
   {
@@ -96,8 +96,8 @@
    "metadata": {},
    "outputs": [],
    "source": [
-    "displaystart = '2021-02-01'\n",
-    "displaystop = '2021-04-08'"
+    "displaystart = '2021-06-01'\n",
+    "displaystop = '2021-10-20'"
    ]
   },
   {
@@ -178,6 +178,15 @@
     "df['datetime'] = pd.to_datetime(df.time, format=\"%Y/%m/%d %H:%M:%S\")"
    ]
   },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "df"
+   ]
+  },
   {
    "cell_type": "markdown",
    "metadata": {},
@@ -194,6 +203,51 @@
     "hourly_idx=pd.date_range(startdate, enddate, freq='H')"
    ]
   },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "hourly_idx"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "demodf=pd.DataFrame(np.zeros((1,len(hourly_idx))).T, index=hourly_idx, columns=['sum'])"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "demodf"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "df.entity"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "sorted(df.entity.unique())"
+   ]
+  },
   {
    "cell_type": "code",
    "execution_count": null,
@@ -227,6 +281,15 @@
     "m6_hourly_pwr"
    ]
   },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "m6_hourly_pwr.fillna(0)"
+   ]
+  },
   {
    "cell_type": "markdown",
    "metadata": {},
@@ -248,10 +311,59 @@
    "metadata": {},
    "outputs": [],
    "source": [
-    "num_nodes=36\n",
+    "dftest=m6_hourly_pwr[displaystart:displaystop].fillna(0).iloc[:,1:2]"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "type(dftest)"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "print(np.__version__)"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "!module "
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "dftest.info()"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "startnode=35\n",
+    "stopnode=71\n",
+    "num_nodes=stopnode-startnode\n",
     "fig, axes = plt.subplots(num_nodes,1, sharex=True, figsize=(20,30))\n",
-    "for i in range(num_nodes):\n",
-    "    m6_hourly_pwr[displaystart:displaystop].iloc[:,i+1:i+2].plot(ax=axes[i], legend=True)\n",
+    "for i in range(startnode, startnode+1):\n",
+    "    print(i)\n",
+    "    dftmp=m6_hourly_pwr[displaystart:displaystop].fillna(0).iloc[:,i+1:i+2]\n",
+    "    dftmp.plot(ax=axes[i], legend=True)\n",
     "    axes[i].legend(loc='lower left')"
    ]
   },
@@ -340,7 +452,7 @@
    "metadata": {},
    "outputs": [],
    "source": [
-    "nan_mask = m6_hourly_pwr[\"2021-03-22\":\"2021-03-23\"].isna()"
+    "nan_mask = m6_hourly_pwr[startdate:enddate].isna()"
    ]
   },
   {
@@ -447,6 +559,15 @@
     "    axes[i].legend(loc='lower left')\n"
    ]
   },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "m6_hourly_pwr.iloc[:,133:199].columns"
+   ]
+  },
   {
    "cell_type": "markdown",
    "metadata": {},
@@ -465,7 +586,7 @@
    "metadata": {},
    "outputs": [],
    "source": [
-    "kW = m6_hourly_pwr[displaystart:displaystop].sum(axis=1)/1000"
+    "kW = m6_hourly_pwr.iloc[:,133:199][displaystart:displaystop].sum(axis=1)/1000"
    ]
   },
   {
-- 
GitLab