{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "from datetime import datetime" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
datemax (TH/J)uselessarchaicity (TH/J)
02009-01-010.0000010.0000010.000001
12009-01-020.0000010.0000010.000001
22009-01-030.0000010.0000010.000001
32009-01-040.0000010.0000010.000001
42009-01-050.0000010.0000010.000001
...............
51322023-01-200.0465000.0465000.046500
51332023-01-210.0465000.0465000.046500
51342023-01-220.0465000.0465000.046500
51352023-01-230.0465000.0465000.046500
51362023-01-240.0465000.0465000.046500
\n", "

5137 rows × 4 columns

\n", "
" ], "text/plain": [ " date max (TH/J) useless archaicity (TH/J)\n", "0 2009-01-01 0.000001 0.000001 0.000001\n", "1 2009-01-02 0.000001 0.000001 0.000001\n", "2 2009-01-03 0.000001 0.000001 0.000001\n", "3 2009-01-04 0.000001 0.000001 0.000001\n", "4 2009-01-05 0.000001 0.000001 0.000001\n", "... ... ... ... ...\n", "5132 2023-01-20 0.046500 0.046500 0.046500\n", "5133 2023-01-21 0.046500 0.046500 0.046500\n", "5134 2023-01-22 0.046500 0.046500 0.046500\n", "5135 2023-01-23 0.046500 0.046500 0.046500\n", "5136 2023-01-24 0.046500 0.046500 0.046500\n", "\n", "[5137 rows x 4 columns]" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pmaxv1 = pd.read_csv('pmaxv1/pmaxv1.csv') # rows are date,max (TH/J),useless,archaicity (TH/J)\n", "pmaxv1" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "pmaxv1.index = pd.to_datetime(pmaxv1['date'])" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
max_efficiency
date
2011-01-012.010000e+06
2011-01-022.010000e+06
2011-01-032.010000e+06
2011-01-042.010000e+06
2011-01-052.010000e+06
......
2023-12-275.410000e+10
2023-12-285.410000e+10
2023-12-295.410000e+10
2023-12-305.410000e+10
2023-12-315.410000e+10
\n", "

4748 rows × 1 columns

\n", "
" ], "text/plain": [ " max_efficiency\n", "date \n", "2011-01-01 2.010000e+06\n", "2011-01-02 2.010000e+06\n", "2011-01-03 2.010000e+06\n", "2011-01-04 2.010000e+06\n", "2011-01-05 2.010000e+06\n", "... ...\n", "2023-12-27 5.410000e+10\n", "2023-12-28 5.410000e+10\n", "2023-12-29 5.410000e+10\n", "2023-12-30 5.410000e+10\n", "2023-12-31 5.410000e+10\n", "\n", "[4748 rows x 1 columns]" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pmaxv2 = pd.read_csv('../hardwarelist/pmaxv2.csv') # date\tmax_efficiency\n", "pmaxv2['date'] = pd.to_datetime(pmaxv2['date'])\n", "pmaxv2 = pmaxv2.set_index('date')\n", "pmaxv2" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "C:\\Users\\Timothe\\AppData\\Local\\Temp\\ipykernel_46252\\2826866675.py:6: FutureWarning: The behavior of DataFrame concatenation with empty or all-NA entries is deprecated. In a future version, this will no longer exclude empty or all-NA columns when determining the result dtypes. To retain the old behavior, exclude the relevant entries before the concat operation.\n", " pmaxv3 = pd.concat([pmaxv3, pd.DataFrame([[date, max(max1, max2)]], columns=['date', 'max_efficiency'])])\n" ] } ], "source": [ "# for each date in pmaxv2, get the max between the two dataframes\n", "pmaxv3 = pd.DataFrame(columns=['date', 'max_efficiency'])\n", "for date in pmaxv2.index:\n", " max1 = pmaxv1[pmaxv1.index <= date].iloc[-1]['max (TH/J)']*1e12\n", " max2 = pmaxv2.loc[date]['max_efficiency']\n", " pmaxv3 = pd.concat([pmaxv3, pd.DataFrame([[date, max(max1, max2)]], columns=['date', 'max_efficiency'])])\n", "\n", "pmaxv3.to_csv('../hardwarelist/pmaxv3.csv', index=False)" ] } ], "metadata": { "kernelspec": { "display_name": "py310", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.13" } }, "nbformat": 4, "nbformat_minor": 2 }