Files
2026-10-02 11:10:29 +02:00

826 lines
56 KiB
Plaintext
Executable File

{
"cells": [
{
"cell_type": "markdown",
"id": "872c3b26",
"metadata": {},
"source": [
"# Pendule Ballistique"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "8b46c11f",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np"
]
},
{
"cell_type": "markdown",
"id": "4c64ac96",
"metadata": {},
"source": [
"## Moment d'inertie $\\Theta$ du pendule"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "bcbbe5ab",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Moment d'inertie pour m1: Θ = 0.018 ± 0.0003 kg·m²\n",
"Moment d'inertie pour m2: Θ = 0.021 ± 0.0004 kg·m²\n"
]
}
],
"source": [
"# constantes\n",
"g = 9.81 # acceleration de la gravite\n",
"\n",
"# variables\n",
"\n",
"m1 = 23.25e-3 # masse balle 1\n",
"m2 = 66.00e-3 # masse balle 2\n",
"M = 196.70e-3 # masse pendule\n",
"dm = 0.01e-3 # incertitude masse\n",
"rcm1 = 275e-3 # distance centre de masse pendule\n",
"drcm1 = 1e-3 # incertitude distance centre de masse pendule\n",
"rcm2 = 279e-3\n",
"drcm2 = 1e-3\n",
"r = 295e-3 # distance d'impact\n",
"dr = 1e-3 # incertitude distance d'impact\n",
"n = 20 # nombre d'oscillations\n",
"t1 = 21.81\n",
"t2 = 21.67 # temps pour n oscillations\n",
"dt = 0.2 # incertitude temps pour n oscillations\n",
"\n",
"# calcul moment d'inertie moyen pour m1 avec erreurs propagées\n",
"Theta1 = (1 / (4 * np.pi**2)) * (t1 / n)**2 * (m1 + M) * g * rcm1\n",
"dTheta1 = Theta1 * np.sqrt( (2 * dt / t1)**2 + (drcm1 / rcm1)**2 + (np.sqrt(dm**2 + dm**2) / (m1 + M))**2 )\n",
"\n",
"# calcul moment d'inertie moyen pour m2 avec erreurs propagées\n",
"Theta2 = (1 / (4 * np.pi**2)) * (t2 / n)**2 * (m2 + M) * g * rcm2\n",
"dTheta2 = Theta2 * np.sqrt( (2 * dt / t2)**2 + (drcm2 / rcm2)**2 + (np.sqrt(dm**2 + dm**2) / (m2 + M))**2 )\n",
"# affichage des résultats\n",
"print(f\"Moment d'inertie pour m1: Θ = {Theta1:.3f} ± {dTheta1:.4f} kg·m²\")\n",
"print(f\"Moment d'inertie pour m2: Θ = {Theta2:.3f} ± {dTheta2:.4f} kg·m²\")"
]
},
{
"cell_type": "markdown",
"id": "a1cf959b",
"metadata": {},
"source": [
"## Vitesse initiale $v_{0}$ du projectile"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "6f369bb7",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.microsoft.datawrangler.viewer.v0+json": {
"columns": [
{
"name": "index",
"rawType": "object",
"type": "string"
},
{
"name": "0",
"rawType": "object",
"type": "string"
},
{
"name": "1",
"rawType": "object",
"type": "string"
},
{
"name": "2",
"rawType": "object",
"type": "string"
},
{
"name": "3",
"rawType": "object",
"type": "string"
}
],
"ref": "daa3992d-c25b-4989-aaad-6aa288e7f277",
"rows": [
[
"ϕ + δϕ",
"4.363e-01 ± 8.727e-03",
"4.363e-01 ± 8.727e-03",
"3.054e-01 ± 8.727e-03",
"2.007e-01 ± 8.727e-03"
],
[
"v + δv",
"6.500e+00 ± 9.174e-02",
"6.500e+00 ± 9.174e-02",
"4.568e+00 ± 7.956e-02",
"3.009e+00 ± 7.194e-02"
],
[
"p + δp",
"1.511e-01 ± 2.134e-03",
"1.511e-01 ± 2.134e-03",
"1.062e-01 ± 1.850e-03",
"6.995e-02 ± 1.673e-03"
],
[
"L + δL",
"4.458e-02 ± 6.474e-04",
"4.458e-02 ± 6.474e-04",
"3.133e-02 ± 5.561e-04",
"2.064e-02 ± 4.985e-04"
],
[
"Ke1 + δKe1",
"4.911e-01 ± 1.387e-02",
"4.911e-01 ± 1.387e-02",
"2.426e-01 ± 8.451e-03",
"1.052e-01 ± 5.033e-03"
],
[
"Ke + δKe",
"5.559e-02 ± 2.198e-03",
"5.559e-02 ± 2.198e-03",
"2.746e-02 ± 1.560e-03",
"1.191e-02 ± 1.033e-03"
],
[
"ε + δε",
"1.132e-01 ± 5.499e-03",
"1.132e-01 ± 5.499e-03",
"1.132e-01 ± 7.544e-03",
"1.132e-01 ± 1.121e-02"
]
],
"shape": {
"columns": 4,
"rows": 7
}
},
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>0</th>\n",
" <th>1</th>\n",
" <th>2</th>\n",
" <th>3</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>ϕ + δϕ</th>\n",
" <td>4.363e-01 ± 8.727e-03</td>\n",
" <td>4.363e-01 ± 8.727e-03</td>\n",
" <td>3.054e-01 ± 8.727e-03</td>\n",
" <td>2.007e-01 ± 8.727e-03</td>\n",
" </tr>\n",
" <tr>\n",
" <th>v + δv</th>\n",
" <td>6.500e+00 ± 9.174e-02</td>\n",
" <td>6.500e+00 ± 9.174e-02</td>\n",
" <td>4.568e+00 ± 7.956e-02</td>\n",
" <td>3.009e+00 ± 7.194e-02</td>\n",
" </tr>\n",
" <tr>\n",
" <th>p + δp</th>\n",
" <td>1.511e-01 ± 2.134e-03</td>\n",
" <td>1.511e-01 ± 2.134e-03</td>\n",
" <td>1.062e-01 ± 1.850e-03</td>\n",
" <td>6.995e-02 ± 1.673e-03</td>\n",
" </tr>\n",
" <tr>\n",
" <th>L + δL</th>\n",
" <td>4.458e-02 ± 6.474e-04</td>\n",
" <td>4.458e-02 ± 6.474e-04</td>\n",
" <td>3.133e-02 ± 5.561e-04</td>\n",
" <td>2.064e-02 ± 4.985e-04</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Ke1 + δKe1</th>\n",
" <td>4.911e-01 ± 1.387e-02</td>\n",
" <td>4.911e-01 ± 1.387e-02</td>\n",
" <td>2.426e-01 ± 8.451e-03</td>\n",
" <td>1.052e-01 ± 5.033e-03</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Ke + δKe</th>\n",
" <td>5.559e-02 ± 2.198e-03</td>\n",
" <td>5.559e-02 ± 2.198e-03</td>\n",
" <td>2.746e-02 ± 1.560e-03</td>\n",
" <td>1.191e-02 ± 1.033e-03</td>\n",
" </tr>\n",
" <tr>\n",
" <th>ε + δε</th>\n",
" <td>1.132e-01 ± 5.499e-03</td>\n",
" <td>1.132e-01 ± 5.499e-03</td>\n",
" <td>1.132e-01 ± 7.544e-03</td>\n",
" <td>1.132e-01 ± 1.121e-02</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" 0 1 \\\n",
"ϕ + δϕ 4.363e-01 ± 8.727e-03 4.363e-01 ± 8.727e-03 \n",
"v + δv 6.500e+00 ± 9.174e-02 6.500e+00 ± 9.174e-02 \n",
"p + δp 1.511e-01 ± 2.134e-03 1.511e-01 ± 2.134e-03 \n",
"L + δL 4.458e-02 ± 6.474e-04 4.458e-02 ± 6.474e-04 \n",
"Ke1 + δKe1 4.911e-01 ± 1.387e-02 4.911e-01 ± 1.387e-02 \n",
"Ke + δKe 5.559e-02 ± 2.198e-03 5.559e-02 ± 2.198e-03 \n",
"ε + δε 1.132e-01 ± 5.499e-03 1.132e-01 ± 5.499e-03 \n",
"\n",
" 2 3 \n",
"ϕ + δϕ 3.054e-01 ± 8.727e-03 2.007e-01 ± 8.727e-03 \n",
"v + δv 4.568e+00 ± 7.956e-02 3.009e+00 ± 7.194e-02 \n",
"p + δp 1.062e-01 ± 1.850e-03 6.995e-02 ± 1.673e-03 \n",
"L + δL 3.133e-02 ± 5.561e-04 2.064e-02 ± 4.985e-04 \n",
"Ke1 + δKe1 2.426e-01 ± 8.451e-03 1.052e-01 ± 5.033e-03 \n",
"Ke + δKe 2.746e-02 ± 1.560e-03 1.191e-02 ± 1.033e-03 \n",
"ε + δε 1.132e-01 ± 7.544e-03 1.132e-01 ± 1.121e-02 "
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"v1df = pd.DataFrame({\n",
" 'phi': np.deg2rad([25, 25, 17.5, 11.5]),\n",
" 'dphi': np.deg2rad([0.5, 0.5, 0.5, 0.5]),\n",
" 'v': [np.nan]*4,\n",
" 'dv': [np.nan]*4,\n",
" 'p': [np.nan]*4,\n",
" 'dp': [np.nan]*4,\n",
" 'L': [np.nan]*4,\n",
" 'dL': [np.nan]*4,\n",
" 'Ke': [np.nan]*4,\n",
" 'dKe': [np.nan]*4,\n",
" 'Kp': [np.nan]*4,\n",
" 'dKp': [np.nan]*4,\n",
" 'eps': [np.nan]*4,\n",
" 'deps': [np.nan]*4,\n",
"})\n",
"\n",
"v2df = pd.DataFrame({\n",
" 'phi': np.deg2rad([46, 46, 33, 21]),\n",
" 'dphi': np.deg2rad([0.5, 0.5, 0.5, 0.5]),\n",
" 'v': [np.nan]*4,\n",
" 'dv': [np.nan]*4,\n",
" 'p': [np.nan]*4,\n",
" 'dp': [np.nan]*4,\n",
" 'L': [np.nan]*4,\n",
" 'dL': [np.nan]*4,\n",
" 'Ke': [np.nan]*4,\n",
" 'dKe': [np.nan]*4,\n",
" 'Kp': [np.nan]*4,\n",
" 'dKp': [np.nan]*4,\n",
" 'eps': [np.nan]*4,\n",
" 'deps': [np.nan]*4,\n",
"})\n",
"\n",
"v = lambda df, m, Theta, r, rcm: (1 / (m * r)) * np.sqrt(2 * g * (m + M) * Theta * rcm * (1 - np.cos(df['phi'])))\n",
"\n",
"p = lambda df, m: m * df['v']\n",
"\n",
"L = lambda df, r: df['p'] * r\n",
"\n",
"Ke = lambda df, m: 1 / 2 * m * df['v']**2\n",
"\n",
"Kp = lambda df, m, M, rcm: (m + M) * rcm * g * (1 - np.cos(df['phi']))\n",
"\n",
"eps = lambda df: df['Kp'] / df['Ke']\n",
"\n",
"\n",
"dv = lambda df, m, Theta, dTheta, rcm, drcm, r, dr, M, dm: np.sqrt(\n",
" ((-1 / (m**2 * r)) * np.sqrt(2 * g * (m + M) * Theta * rcm * (1 - np.cos(df['phi']))) * dm)**2 + \n",
" ((-1 / (m * r**2)) * np.sqrt(2 * g * (m + M) * Theta * rcm * (1 - np.cos(df['phi']))) * dr)**2 + \n",
" ((np.sqrt(2 * g * (m + M) * Theta * rcm * (1 - np.cos(df['phi'])))) / (2 * m * (m + M) * r) * np.sqrt(dm**2 + dm**2))**2 + \n",
" ((np.sqrt(2 * g * (m + M) * Theta * rcm * (1 - np.cos(df['phi'])))) / (2 * m * r * rcm) * drcm)**2 + \n",
" ((np.sqrt(2 * g * (m + M) * Theta * rcm * (1 - np.cos(df['phi'])))) / (2 * m * r * Theta) * dTheta)**2 + \n",
" (((m + M) * Theta * rcm * g * np.sin(df['phi'])) / (2 * m * r * np.sqrt(2 * g * (m + M) * Theta * rcm * (1 - np.cos(df['phi'])))) * df['dphi'])**2 \n",
")\n",
"\n",
"\n",
"dp = lambda df, m, dm: df['p'] * np.sqrt( (dm / m)**2 + (df['dv'] / df['v'])**2 )\n",
"\n",
"dL = lambda df, r, dr: df['L'] * np.sqrt( (df['dp'] / df['p'])**2 + (dr / r)**2 )\n",
"\n",
"dKe = lambda df, m, dm: df['Ke'] * np.sqrt( (dm / m)**2 + (2 * df['dv'] / df['v'])**2 )\n",
"\n",
"dKp = lambda df, M, m, dm, rcm, drcm: np.sqrt((g * rcm * (1 - np.cos(df['phi'])) * 2 * dm * (M + m))**2+\n",
" ((M + m) * g * (1 - np.cos(df['phi'])) * drcm)**2+\n",
" ((M + m) * g * rcm * np.sin(df['phi']) * df['dphi'])**2 )\n",
"\n",
"deps = lambda df: df['eps'] * np.sqrt( (df['dKe'] / df['Ke'])**2 + (df['dKp'] / df['Kp'])**2 )\n",
"\n",
"sci = lambda x: \"{:.3e}\".format(x) if pd.notnull(x) else \"\"\n",
"\n",
"v1df['v'] = v(v1df, m1, Theta1, r, rcm1)\n",
"v1df['dv'] = dv(v1df, m1, Theta1, dTheta1, rcm1, drcm1, r, dr, M, dm)\n",
"v1df['p'] = p(v1df, m1)\n",
"v1df['dp'] = dp(v1df, m1, dm)\n",
"v1df['L'] = L(v1df, r)\n",
"v1df['dL'] = dL(v1df, r, dr)\n",
"v1df['Ke'] = Ke(v1df, m1)\n",
"v1df['dKe'] = dKe(v1df, m1, dm)\n",
"v1df['Kp'] = Kp(v1df, m1, M, rcm1)\n",
"v1df['dKp'] = dKp(v1df, M, m1, dm, rcm1, drcm1)\n",
"v1df['eps'] = eps(v1df)\n",
"v1df['deps'] = deps(v1df)\n",
"\n",
"v1df['ϕ + δϕ'] = v1df['phi'].map(sci) + \" ± \" + v1df['dphi'].map(sci)\n",
"v1df['v + δv'] = v1df['v'].map(sci) + \" ± \" + v1df['dv'].map(sci)\n",
"v1df['p + δp'] = v1df['p'].map(sci) + \" ± \" + v1df['dp'].map(sci)\n",
"v1df['L + δL'] = v1df['L'].map(sci) + \" ± \" + v1df['dL'].map(sci)\n",
"v1df['Ke1 + δKe1'] = v1df['Ke'].map(sci) + \" ± \" + v1df['dKe'].map(sci)\n",
"v1df['Ke + δKe'] = v1df['Kp'].map(sci) + \" ± \" + v1df['dKp'].map(sci)\n",
"v1df['ε + δε'] = v1df['eps'].map(sci) + \" ± \" + v1df['deps'].map(sci)\n",
"\n",
"v1df.drop(columns=['phi', 'dphi', 'v', 'dv', 'p', 'dp', 'L', 'dL', 'Ke', 'dKe', 'Kp', 'dKp', 'eps', 'deps'], inplace=True)\n",
"\n",
"v1df.transpose()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "413117de",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.microsoft.datawrangler.viewer.v0+json": {
"columns": [
{
"name": "index",
"rawType": "object",
"type": "string"
},
{
"name": "0",
"rawType": "object",
"type": "string"
},
{
"name": "1",
"rawType": "object",
"type": "string"
},
{
"name": "2",
"rawType": "object",
"type": "string"
},
{
"name": "3",
"rawType": "object",
"type": "string"
}
],
"ref": "c8403f0c-e197-4d68-987a-45eabaebf300",
"rows": [
[
"ϕ + δϕ",
"8.029e-01 ± 8.727e-03",
"8.029e-01 ± 8.727e-03",
"5.760e-01 ± 8.727e-03",
"3.665e-01 ± 8.727e-03"
],
[
"v + δv",
"4.977e+00 ± 5.664e-02",
"4.977e+00 ± 5.664e-02",
"3.617e+00 ± 4.538e-02",
"2.321e+00 ± 3.608e-02"
],
[
"p + δp",
"3.284e-01 ± 3.739e-03",
"3.284e-01 ± 3.739e-03",
"2.387e-01 ± 2.995e-03",
"1.532e-01 ± 2.382e-03"
],
[
"L + δL",
"9.689e-02 ± 1.151e-03",
"9.689e-02 ± 1.151e-03",
"7.043e-02 ± 9.153e-04",
"4.519e-02 ± 7.191e-04"
],
[
"Ke + δKe",
"8.173e-01 ± 1.860e-02",
"8.173e-01 ± 1.860e-02",
"4.318e-01 ± 1.083e-02",
"1.778e-01 ± 5.527e-03"
],
[
"Kp + δKp",
"2.195e-01 ± 4.582e-03",
"2.195e-01 ± 4.582e-03",
"1.160e-01 ± 3.443e-03",
"4.776e-02 ± 2.255e-03"
],
[
"ε + δε",
"2.686e-01 ± 8.296e-03",
"2.686e-01 ± 8.296e-03",
"2.686e-01 ± 1.044e-02",
"2.686e-01 ± 1.519e-02"
]
],
"shape": {
"columns": 4,
"rows": 7
}
},
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>0</th>\n",
" <th>1</th>\n",
" <th>2</th>\n",
" <th>3</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>ϕ + δϕ</th>\n",
" <td>8.029e-01 ± 8.727e-03</td>\n",
" <td>8.029e-01 ± 8.727e-03</td>\n",
" <td>5.760e-01 ± 8.727e-03</td>\n",
" <td>3.665e-01 ± 8.727e-03</td>\n",
" </tr>\n",
" <tr>\n",
" <th>v + δv</th>\n",
" <td>4.977e+00 ± 5.664e-02</td>\n",
" <td>4.977e+00 ± 5.664e-02</td>\n",
" <td>3.617e+00 ± 4.538e-02</td>\n",
" <td>2.321e+00 ± 3.608e-02</td>\n",
" </tr>\n",
" <tr>\n",
" <th>p + δp</th>\n",
" <td>3.284e-01 ± 3.739e-03</td>\n",
" <td>3.284e-01 ± 3.739e-03</td>\n",
" <td>2.387e-01 ± 2.995e-03</td>\n",
" <td>1.532e-01 ± 2.382e-03</td>\n",
" </tr>\n",
" <tr>\n",
" <th>L + δL</th>\n",
" <td>9.689e-02 ± 1.151e-03</td>\n",
" <td>9.689e-02 ± 1.151e-03</td>\n",
" <td>7.043e-02 ± 9.153e-04</td>\n",
" <td>4.519e-02 ± 7.191e-04</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Ke + δKe</th>\n",
" <td>8.173e-01 ± 1.860e-02</td>\n",
" <td>8.173e-01 ± 1.860e-02</td>\n",
" <td>4.318e-01 ± 1.083e-02</td>\n",
" <td>1.778e-01 ± 5.527e-03</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Kp + δKp</th>\n",
" <td>2.195e-01 ± 4.582e-03</td>\n",
" <td>2.195e-01 ± 4.582e-03</td>\n",
" <td>1.160e-01 ± 3.443e-03</td>\n",
" <td>4.776e-02 ± 2.255e-03</td>\n",
" </tr>\n",
" <tr>\n",
" <th>ε + δε</th>\n",
" <td>2.686e-01 ± 8.296e-03</td>\n",
" <td>2.686e-01 ± 8.296e-03</td>\n",
" <td>2.686e-01 ± 1.044e-02</td>\n",
" <td>2.686e-01 ± 1.519e-02</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" 0 1 2 \\\n",
"ϕ + δϕ 8.029e-01 ± 8.727e-03 8.029e-01 ± 8.727e-03 5.760e-01 ± 8.727e-03 \n",
"v + δv 4.977e+00 ± 5.664e-02 4.977e+00 ± 5.664e-02 3.617e+00 ± 4.538e-02 \n",
"p + δp 3.284e-01 ± 3.739e-03 3.284e-01 ± 3.739e-03 2.387e-01 ± 2.995e-03 \n",
"L + δL 9.689e-02 ± 1.151e-03 9.689e-02 ± 1.151e-03 7.043e-02 ± 9.153e-04 \n",
"Ke + δKe 8.173e-01 ± 1.860e-02 8.173e-01 ± 1.860e-02 4.318e-01 ± 1.083e-02 \n",
"Kp + δKp 2.195e-01 ± 4.582e-03 2.195e-01 ± 4.582e-03 1.160e-01 ± 3.443e-03 \n",
"ε + δε 2.686e-01 ± 8.296e-03 2.686e-01 ± 8.296e-03 2.686e-01 ± 1.044e-02 \n",
"\n",
" 3 \n",
"ϕ + δϕ 3.665e-01 ± 8.727e-03 \n",
"v + δv 2.321e+00 ± 3.608e-02 \n",
"p + δp 1.532e-01 ± 2.382e-03 \n",
"L + δL 4.519e-02 ± 7.191e-04 \n",
"Ke + δKe 1.778e-01 ± 5.527e-03 \n",
"Kp + δKp 4.776e-02 ± 2.255e-03 \n",
"ε + δε 2.686e-01 ± 1.519e-02 "
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"v2df['v'] = v(v2df, m2, Theta2, r, rcm2)\n",
"v2df['dv'] = dv(v2df, m2, Theta2, dTheta2, rcm2, drcm2, r, dr, M, dm)\n",
"v2df['p'] = p(v2df, m2)\n",
"v2df['dp'] = dp(v2df, m2, dm)\n",
"v2df['L'] = L(v2df, r)\n",
"v2df['dL'] = dL(v2df, r, dr)\n",
"v2df['Ke'] = Ke(v2df, m2)\n",
"v2df['dKe'] = dKe(v2df, m2, dm)\n",
"v2df['Kp'] = Kp(v2df, m2, M, rcm2)\n",
"v2df['dKp'] = dKp(v2df, M, m2, dm, rcm2, drcm2)\n",
"v2df['eps'] = eps(v2df)\n",
"v2df['deps'] = deps(v2df)\n",
"\n",
"v2df['ϕ + δϕ'] = v2df['phi'].map(sci) + \" ± \" + v2df['dphi'].map(sci)\n",
"v2df['v + δv'] = v2df['v'].map(sci) + \" ± \" + v2df['dv'].map(sci)\n",
"v2df['p + δp'] = v2df['p'].map(sci) + \" ± \" + v2df['dp'].map(sci)\n",
"v2df['L + δL'] = v2df['L'].map(sci) + \" ± \" + v2df['dL'].map(sci)\n",
"v2df['Ke2 + δKe2'] = v2df['Ke'].map(sci) + \" ± \" + v2df['dKe'].map(sci)\n",
"v2df['Ke + δKe'] = v2df['Kp'].map(sci) + \" ± \" + v2df['dKp'].map(sci)\n",
"v2df['ε + δε'] = v2df['eps'].map(sci) + \" ± \" + v2df['deps'].map(sci)\n",
"\n",
"v2df.drop(columns=['phi', 'dphi', 'v', 'dv', 'p', 'dp', 'L', 'dL', 'Ke', 'dKe', 'Kp', 'dKp', 'eps', 'deps'], inplace=True)\n",
"\n",
"v2df.transpose()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7b262a92",
"metadata": {},
"outputs": [],
"source": [
"v1 = v1df['v'].mean()\n",
"dv1 = np.sqrt( (v1df['dv']**2).sum() ) / len(v1df)\n",
"\n",
"v2 = v2df['v'].mean()\n",
"dv2 = np.sqrt( (v2df['dv']**2).sum() ) / len(v2df)\n",
"\n",
"print(f\"Vitesse initiale moyenne pour m1: v0 = {v1:.3f} ± {dv1:.3f} m/s\")\n",
"print(f\"Vitesse initiale moyenne pour m2: v0 = {v2:.3f} ± {dv2:.3f} m/s\")"
]
},
{
"cell_type": "markdown",
"id": "443a2872",
"metadata": {},
"source": [
"## Énergie du lanceur"
]
},
{
"cell_type": "code",
"execution_count": 30,
"id": "9522e843",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Energie potentielle emmagasinée: U = 2.053 ± 0.072 J\n"
]
}
],
"source": [
"k = 618\n",
"dk = 14\n",
"x1 = 0.028\n",
"dx1 = 0.0001\n",
"x2 = 0.101\n",
"dx2 = 0.0001\n",
"x0 = 0.019\n",
"dx0 = 0.0012\n",
"\n",
"U = k/2 * ( (x2 - x0)**2 - (x1 - x0)**2 )\n",
"dU = np.sqrt( (1 / 2 * ((x2 - x0)**2 - (x1 - x0)**2) * dk)**2 + (k * (x2 - x0) * dx2)**2 + (-k * (x1 - x0) * dx1)**2 + (-k * (x2 - x1) * dx0)**2 )\n",
"\n",
"print(f\"Energie potentielle emmagasinée: U = {U:.3f} ± {dU:.3f} J\")"
]
},
{
"cell_type": "code",
"execution_count": 36,
"id": "7471d528",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: pip in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (25.2)\n",
"Collecting pip\n",
" Downloading pip-25.3-py3-none-any.whl.metadata (4.7 kB)\n",
"Downloading pip-25.3-py3-none-any.whl (1.8 MB)\n",
" ---------------------------------------- 0.0/1.8 MB ? eta -:--:--\n",
" ----------------------------- ---------- 1.3/1.8 MB 7.3 MB/s eta 0:00:01\n",
" ---------------------------------------- 1.8/1.8 MB 6.0 MB/s 0:00:00\n",
"Installing collected packages: pip\n",
" Attempting uninstall: pip\n",
" Found existing installation: pip 25.2\n",
" Uninstalling pip-25.2:\n",
" Successfully uninstalled pip-25.2\n",
"Successfully installed pip-25.3\n",
"Note: you may need to restart the kernel to use updated packages.\n",
"Requirement already satisfied: dataframe_image in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (0.2.7)\n",
"Requirement already satisfied: pandas>=0.24 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from dataframe_image) (2.2.3)\n",
"Requirement already satisfied: nbconvert>=5 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from dataframe_image) (7.16.6)\n",
"Requirement already satisfied: aiohttp>=3.10.2 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from dataframe_image) (3.13.2)\n",
"Requirement already satisfied: requests in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from dataframe_image) (2.32.3)\n",
"Requirement already satisfied: pillow in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from dataframe_image) (11.1.0)\n",
"Requirement already satisfied: packaging in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from dataframe_image) (24.2)\n",
"Requirement already satisfied: mistune in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from dataframe_image) (3.1.4)\n",
"Requirement already satisfied: lxml in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from dataframe_image) (6.0.2)\n",
"Requirement already satisfied: beautifulsoup4 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from dataframe_image) (4.13.3)\n",
"Requirement already satisfied: cssutils in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from dataframe_image) (2.11.1)\n",
"Requirement already satisfied: playwright in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from dataframe_image) (1.55.0)\n",
"Requirement already satisfied: cssselect in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from dataframe_image) (1.3.0)\n",
"Requirement already satisfied: aiohappyeyeballs>=2.5.0 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from aiohttp>=3.10.2->dataframe_image) (2.6.1)\n",
"Requirement already satisfied: aiosignal>=1.4.0 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from aiohttp>=3.10.2->dataframe_image) (1.4.0)\n",
"Requirement already satisfied: attrs>=17.3.0 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from aiohttp>=3.10.2->dataframe_image) (25.3.0)\n",
"Requirement already satisfied: frozenlist>=1.1.1 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from aiohttp>=3.10.2->dataframe_image) (1.8.0)\n",
"Requirement already satisfied: multidict<7.0,>=4.5 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from aiohttp>=3.10.2->dataframe_image) (6.7.0)\n",
"Requirement already satisfied: propcache>=0.2.0 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from aiohttp>=3.10.2->dataframe_image) (0.4.1)\n",
"Requirement already satisfied: yarl<2.0,>=1.17.0 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from aiohttp>=3.10.2->dataframe_image) (1.22.0)\n",
"Requirement already satisfied: idna>=2.0 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from yarl<2.0,>=1.17.0->aiohttp>=3.10.2->dataframe_image) (3.10)\n",
"Requirement already satisfied: bleach!=5.0.0 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from bleach[css]!=5.0.0->nbconvert>=5->dataframe_image) (6.3.0)\n",
"Requirement already satisfied: defusedxml in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from nbconvert>=5->dataframe_image) (0.7.1)\n",
"Requirement already satisfied: jinja2>=3.0 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from nbconvert>=5->dataframe_image) (3.1.5)\n",
"Requirement already satisfied: jupyter-core>=4.7 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from nbconvert>=5->dataframe_image) (5.7.2)\n",
"Requirement already satisfied: jupyterlab-pygments in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from nbconvert>=5->dataframe_image) (0.3.0)\n",
"Requirement already satisfied: markupsafe>=2.0 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from nbconvert>=5->dataframe_image) (3.0.2)\n",
"Requirement already satisfied: nbclient>=0.5.0 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from nbconvert>=5->dataframe_image) (0.10.2)\n",
"Requirement already satisfied: nbformat>=5.7 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from nbconvert>=5->dataframe_image) (5.10.4)\n",
"Requirement already satisfied: pandocfilters>=1.4.1 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from nbconvert>=5->dataframe_image) (1.5.1)\n",
"Requirement already satisfied: pygments>=2.4.1 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from nbconvert>=5->dataframe_image) (2.19.1)\n",
"Requirement already satisfied: traitlets>=5.1 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from nbconvert>=5->dataframe_image) (5.14.3)\n",
"Requirement already satisfied: webencodings in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from bleach!=5.0.0->bleach[css]!=5.0.0->nbconvert>=5->dataframe_image) (0.5.1)\n",
"Requirement already satisfied: tinycss2<1.5,>=1.1.0 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from bleach[css]!=5.0.0->nbconvert>=5->dataframe_image) (1.4.0)\n",
"Requirement already satisfied: platformdirs>=2.5 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from jupyter-core>=4.7->nbconvert>=5->dataframe_image) (4.3.7)\n",
"Requirement already satisfied: pywin32>=300 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from jupyter-core>=4.7->nbconvert>=5->dataframe_image) (310)\n",
"Requirement already satisfied: jupyter-client>=6.1.12 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from nbclient>=0.5.0->nbconvert>=5->dataframe_image) (8.6.3)\n",
"Requirement already satisfied: python-dateutil>=2.8.2 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from jupyter-client>=6.1.12->nbclient>=0.5.0->nbconvert>=5->dataframe_image) (2.9.0.post0)\n",
"Requirement already satisfied: pyzmq>=23.0 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from jupyter-client>=6.1.12->nbclient>=0.5.0->nbconvert>=5->dataframe_image) (26.3.0)\n",
"Requirement already satisfied: tornado>=6.2 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from jupyter-client>=6.1.12->nbclient>=0.5.0->nbconvert>=5->dataframe_image) (6.4.2)\n",
"Requirement already satisfied: fastjsonschema>=2.15 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from nbformat>=5.7->nbconvert>=5->dataframe_image) (2.21.1)\n",
"Requirement already satisfied: jsonschema>=2.6 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from nbformat>=5.7->nbconvert>=5->dataframe_image) (4.23.0)\n",
"Requirement already satisfied: jsonschema-specifications>=2023.03.6 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from jsonschema>=2.6->nbformat>=5.7->nbconvert>=5->dataframe_image) (2024.10.1)\n",
"Requirement already satisfied: referencing>=0.28.4 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from jsonschema>=2.6->nbformat>=5.7->nbconvert>=5->dataframe_image) (0.36.2)\n",
"Requirement already satisfied: rpds-py>=0.7.1 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from jsonschema>=2.6->nbformat>=5.7->nbconvert>=5->dataframe_image) (0.23.1)\n",
"Requirement already satisfied: numpy>=1.26.0 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from pandas>=0.24->dataframe_image) (2.2.0)\n",
"Requirement already satisfied: pytz>=2020.1 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from pandas>=0.24->dataframe_image) (2025.1)\n",
"Requirement already satisfied: tzdata>=2022.7 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from pandas>=0.24->dataframe_image) (2025.1)\n",
"Requirement already satisfied: six>=1.5 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from python-dateutil>=2.8.2->jupyter-client>=6.1.12->nbclient>=0.5.0->nbconvert>=5->dataframe_image) (1.17.0)\n",
"Requirement already satisfied: soupsieve>1.2 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from beautifulsoup4->dataframe_image) (2.6)\n",
"Requirement already satisfied: typing-extensions>=4.0.0 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from beautifulsoup4->dataframe_image) (4.14.1)\n",
"Requirement already satisfied: more-itertools in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from cssutils->dataframe_image) (10.8.0)\n",
"Requirement already satisfied: pyee<14,>=13 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from playwright->dataframe_image) (13.0.0)\n",
"Requirement already satisfied: greenlet<4.0.0,>=3.1.1 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from playwright->dataframe_image) (3.1.1)\n",
"Requirement already satisfied: charset-normalizer<4,>=2 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from requests->dataframe_image) (3.4.1)\n",
"Requirement already satisfied: urllib3<3,>=1.21.1 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from requests->dataframe_image) (2.4.0)\n",
"Requirement already satisfied: certifi>=2017.4.17 in c:\\users\\romai\\appdata\\local\\programs\\python\\python313\\lib\\site-packages (from requests->dataframe_image) (2025.6.15)\n",
"Note: you may need to restart the kernel to use updated packages.\n"
]
}
],
"source": [
"# PowerShell\n",
"%pip install --upgrade pip\n",
"%pip install dataframe_image\n"
]
},
{
"cell_type": "code",
"execution_count": 37,
"id": "84d4d92c",
"metadata": {},
"outputs": [
{
"ename": "KeyError",
"evalue": "\"None of [Index(['v'], dtype='object')] are in the [columns]\"",
"output_type": "error",
"traceback": [
"\u001b[31m---------------------------------------------------------------------------\u001b[39m",
"\u001b[31mKeyError\u001b[39m Traceback (most recent call last)",
"\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[37]\u001b[39m\u001b[32m, line 7\u001b[39m\n\u001b[32m 2\u001b[39m styled = v1df.style \\\n\u001b[32m 3\u001b[39m .set_table_styles([{\u001b[33m'\u001b[39m\u001b[33mselector\u001b[39m\u001b[33m'\u001b[39m: \u001b[33m'\u001b[39m\u001b[33mth\u001b[39m\u001b[33m'\u001b[39m, \u001b[33m'\u001b[39m\u001b[33mprops\u001b[39m\u001b[33m'\u001b[39m: [(\u001b[33m'\u001b[39m\u001b[33mfont-size\u001b[39m\u001b[33m'\u001b[39m, \u001b[33m'\u001b[39m\u001b[33m12pt\u001b[39m\u001b[33m'\u001b[39m)]}]) \\\n\u001b[32m 4\u001b[39m .background_gradient(subset=[\u001b[33m'\u001b[39m\u001b[33mv\u001b[39m\u001b[33m'\u001b[39m], cmap=\u001b[33m'\u001b[39m\u001b[33mBlues\u001b[39m\u001b[33m'\u001b[39m)\n\u001b[32m 6\u001b[39m \u001b[38;5;66;03m# export to PNG\u001b[39;00m\n\u001b[32m----> \u001b[39m\u001b[32m7\u001b[39m \u001b[43mdfi\u001b[49m\u001b[43m.\u001b[49m\u001b[43mexport\u001b[49m\u001b[43m(\u001b[49m\u001b[43mstyled\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[33;43m'\u001b[39;49m\u001b[33;43mv1df.png\u001b[39;49m\u001b[33;43m'\u001b[39;49m\u001b[43m)\u001b[49m\n",
"\u001b[36mFile \u001b[39m\u001b[32mc:\\Users\\romai\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\dataframe_image\\_pandas_accessor.py:222\u001b[39m, in \u001b[36mexport\u001b[39m\u001b[34m(obj, filename, fontsize, max_rows, max_cols, table_conversion, chrome_path, dpi, use_mathjax, crop_top)\u001b[39m\n\u001b[32m 197\u001b[39m \u001b[38;5;250m\u001b[39m\u001b[33;03m\"\"\"export a DataFrame as png to a file\u001b[39;00m\n\u001b[32m 198\u001b[39m \n\u001b[32m 199\u001b[39m \u001b[33;03mArgs:\u001b[39;00m\n\u001b[32m (...)\u001b[39m\u001b[32m 209\u001b[39m \u001b[33;03m crop_top: bool, optional, crop top of the generate image, default True\u001b[39;00m\n\u001b[32m 210\u001b[39m \u001b[33;03m\"\"\"\u001b[39;00m\n\u001b[32m 211\u001b[39m converter = prepare_converter(\n\u001b[32m 212\u001b[39m filename,\n\u001b[32m 213\u001b[39m fontsize,\n\u001b[32m (...)\u001b[39m\u001b[32m 220\u001b[39m crop_top=crop_top,\n\u001b[32m 221\u001b[39m )\n\u001b[32m--> \u001b[39m\u001b[32m222\u001b[39m html = \u001b[43mgenerate_html\u001b[49m\u001b[43m(\u001b[49m\u001b[43mobj\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfilename\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmax_rows\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmax_cols\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 224\u001b[39m \u001b[38;5;28;01mwith\u001b[39;00m disable_max_image_pixels():\n\u001b[32m 225\u001b[39m img_str = converter(html)\n",
"\u001b[36mFile \u001b[39m\u001b[32mc:\\Users\\romai\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\dataframe_image\\_pandas_accessor.py:164\u001b[39m, in \u001b[36mgenerate_html\u001b[39m\u001b[34m(obj, filename, max_rows, max_cols)\u001b[39m\n\u001b[32m 161\u001b[39m max_cols = \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[32m 163\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m is_styler:\n\u001b[32m--> \u001b[39m\u001b[32m164\u001b[39m html = \u001b[43mstyler2html\u001b[49m\u001b[43m(\u001b[49m\u001b[43mobj\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 165\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[32m 166\u001b[39m html = obj.to_html(max_rows=max_rows, max_cols=max_cols, notebook=\u001b[38;5;28;01mTrue\u001b[39;00m)\n",
"\u001b[36mFile \u001b[39m\u001b[32mc:\\Users\\romai\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\dataframe_image\\pd_html.py:8\u001b[39m, in \u001b[36mstyler2html\u001b[39m\u001b[34m(style)\u001b[39m\n\u001b[32m 6\u001b[39m \u001b[38;5;250m\u001b[39m\u001b[33;03m\"\"\"convert dataframe and sytler to html base on different pandas version\"\"\"\u001b[39;00m\n\u001b[32m 7\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m version.parse(pd.__version__) >= version.parse(\u001b[33m\"\u001b[39m\u001b[33m1.4\u001b[39m\u001b[33m\"\u001b[39m):\n\u001b[32m----> \u001b[39m\u001b[32m8\u001b[39m html = \u001b[43mstyle\u001b[49m\u001b[43m.\u001b[49m\u001b[43mto_html\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 9\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[32m 10\u001b[39m html = style.render()\n",
"\u001b[36mFile \u001b[39m\u001b[32mc:\\Users\\romai\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\pandas\\io\\formats\\style.py:1345\u001b[39m, in \u001b[36mStyler.to_html\u001b[39m\u001b[34m(self, buf, table_uuid, table_attributes, sparse_index, sparse_columns, bold_headers, caption, max_rows, max_columns, encoding, doctype_html, exclude_styles, **kwargs)\u001b[39m\n\u001b[32m 1342\u001b[39m obj.set_caption(caption)\n\u001b[32m 1344\u001b[39m \u001b[38;5;66;03m# Build HTML string..\u001b[39;00m\n\u001b[32m-> \u001b[39m\u001b[32m1345\u001b[39m html = \u001b[43mobj\u001b[49m\u001b[43m.\u001b[49m\u001b[43m_render_html\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 1346\u001b[39m \u001b[43m \u001b[49m\u001b[43msparse_index\u001b[49m\u001b[43m=\u001b[49m\u001b[43msparse_index\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1347\u001b[39m \u001b[43m \u001b[49m\u001b[43msparse_columns\u001b[49m\u001b[43m=\u001b[49m\u001b[43msparse_columns\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1348\u001b[39m \u001b[43m \u001b[49m\u001b[43mmax_rows\u001b[49m\u001b[43m=\u001b[49m\u001b[43mmax_rows\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1349\u001b[39m \u001b[43m \u001b[49m\u001b[43mmax_cols\u001b[49m\u001b[43m=\u001b[49m\u001b[43mmax_columns\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1350\u001b[39m \u001b[43m \u001b[49m\u001b[43mexclude_styles\u001b[49m\u001b[43m=\u001b[49m\u001b[43mexclude_styles\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1351\u001b[39m \u001b[43m \u001b[49m\u001b[43mencoding\u001b[49m\u001b[43m=\u001b[49m\u001b[43mencoding\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01mor\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mget_option\u001b[49m\u001b[43m(\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mstyler.render.encoding\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1352\u001b[39m \u001b[43m \u001b[49m\u001b[43mdoctype_html\u001b[49m\u001b[43m=\u001b[49m\u001b[43mdoctype_html\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1353\u001b[39m \u001b[43m \u001b[49m\u001b[43m*\u001b[49m\u001b[43m*\u001b[49m\u001b[43mkwargs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1354\u001b[39m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 1356\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m save_to_buffer(\n\u001b[32m 1357\u001b[39m html, buf=buf, encoding=(encoding \u001b[38;5;28;01mif\u001b[39;00m buf \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m)\n\u001b[32m 1358\u001b[39m )\n",
"\u001b[36mFile \u001b[39m\u001b[32mc:\\Users\\romai\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\pandas\\io\\formats\\style_render.py:204\u001b[39m, in \u001b[36mStylerRenderer._render_html\u001b[39m\u001b[34m(self, sparse_index, sparse_columns, max_rows, max_cols, **kwargs)\u001b[39m\n\u001b[32m 192\u001b[39m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34m_render_html\u001b[39m(\n\u001b[32m 193\u001b[39m \u001b[38;5;28mself\u001b[39m,\n\u001b[32m 194\u001b[39m sparse_index: \u001b[38;5;28mbool\u001b[39m,\n\u001b[32m (...)\u001b[39m\u001b[32m 198\u001b[39m **kwargs,\n\u001b[32m 199\u001b[39m ) -> \u001b[38;5;28mstr\u001b[39m:\n\u001b[32m 200\u001b[39m \u001b[38;5;250m \u001b[39m\u001b[33;03m\"\"\"\u001b[39;00m\n\u001b[32m 201\u001b[39m \u001b[33;03m Renders the ``Styler`` including all applied styles to HTML.\u001b[39;00m\n\u001b[32m 202\u001b[39m \u001b[33;03m Generates a dict with necessary kwargs passed to jinja2 template.\u001b[39;00m\n\u001b[32m 203\u001b[39m \u001b[33;03m \"\"\"\u001b[39;00m\n\u001b[32m--> \u001b[39m\u001b[32m204\u001b[39m d = \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_render\u001b[49m\u001b[43m(\u001b[49m\u001b[43msparse_index\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43msparse_columns\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmax_rows\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmax_cols\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43m&nbsp;\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[32m 205\u001b[39m d.update(kwargs)\n\u001b[32m 206\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m.template_html.render(\n\u001b[32m 207\u001b[39m **d,\n\u001b[32m 208\u001b[39m html_table_tpl=\u001b[38;5;28mself\u001b[39m.template_html_table,\n\u001b[32m 209\u001b[39m html_style_tpl=\u001b[38;5;28mself\u001b[39m.template_html_style,\n\u001b[32m 210\u001b[39m )\n",
"\u001b[36mFile \u001b[39m\u001b[32mc:\\Users\\romai\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\pandas\\io\\formats\\style_render.py:161\u001b[39m, in \u001b[36mStylerRenderer._render\u001b[39m\u001b[34m(self, sparse_index, sparse_columns, max_rows, max_cols, blank)\u001b[39m\n\u001b[32m 147\u001b[39m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34m_render\u001b[39m(\n\u001b[32m 148\u001b[39m \u001b[38;5;28mself\u001b[39m,\n\u001b[32m 149\u001b[39m sparse_index: \u001b[38;5;28mbool\u001b[39m,\n\u001b[32m (...)\u001b[39m\u001b[32m 153\u001b[39m blank: \u001b[38;5;28mstr\u001b[39m = \u001b[33m\"\u001b[39m\u001b[33m\"\u001b[39m,\n\u001b[32m 154\u001b[39m ):\n\u001b[32m 155\u001b[39m \u001b[38;5;250m \u001b[39m\u001b[33;03m\"\"\"\u001b[39;00m\n\u001b[32m 156\u001b[39m \u001b[33;03m Computes and applies styles and then generates the general render dicts.\u001b[39;00m\n\u001b[32m 157\u001b[39m \n\u001b[32m 158\u001b[39m \u001b[33;03m Also extends the `ctx` and `ctx_index` attributes with those of concatenated\u001b[39;00m\n\u001b[32m 159\u001b[39m \u001b[33;03m stylers for use within `_translate_latex`\u001b[39;00m\n\u001b[32m 160\u001b[39m \u001b[33;03m \"\"\"\u001b[39;00m\n\u001b[32m--> \u001b[39m\u001b[32m161\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_compute\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 162\u001b[39m dxs = []\n\u001b[32m 163\u001b[39m ctx_len = \u001b[38;5;28mlen\u001b[39m(\u001b[38;5;28mself\u001b[39m.index)\n",
"\u001b[36mFile \u001b[39m\u001b[32mc:\\Users\\romai\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\pandas\\io\\formats\\style_render.py:256\u001b[39m, in \u001b[36mStylerRenderer._compute\u001b[39m\u001b[34m(self)\u001b[39m\n\u001b[32m 254\u001b[39m r = \u001b[38;5;28mself\u001b[39m\n\u001b[32m 255\u001b[39m \u001b[38;5;28;01mfor\u001b[39;00m func, args, kwargs \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m._todo:\n\u001b[32m--> \u001b[39m\u001b[32m256\u001b[39m r = \u001b[43mfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m(\u001b[49m\u001b[43m*\u001b[49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m*\u001b[49m\u001b[43m*\u001b[49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 257\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m r\n",
"\u001b[36mFile \u001b[39m\u001b[32mc:\\Users\\romai\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\pandas\\io\\formats\\style.py:1705\u001b[39m, in \u001b[36mStyler._apply\u001b[39m\u001b[34m(self, func, axis, subset, **kwargs)\u001b[39m\n\u001b[32m 1703\u001b[39m subset = \u001b[38;5;28mslice\u001b[39m(\u001b[38;5;28;01mNone\u001b[39;00m) \u001b[38;5;28;01mif\u001b[39;00m subset \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;28;01melse\u001b[39;00m subset\n\u001b[32m 1704\u001b[39m subset = non_reducing_slice(subset)\n\u001b[32m-> \u001b[39m\u001b[32m1705\u001b[39m data = \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43mdata\u001b[49m\u001b[43m.\u001b[49m\u001b[43mloc\u001b[49m\u001b[43m[\u001b[49m\u001b[43msubset\u001b[49m\u001b[43m]\u001b[49m\n\u001b[32m 1706\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m data.empty:\n\u001b[32m 1707\u001b[39m result = DataFrame()\n",
"\u001b[36mFile \u001b[39m\u001b[32mc:\\Users\\romai\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\pandas\\core\\indexing.py:1184\u001b[39m, in \u001b[36m_LocationIndexer.__getitem__\u001b[39m\u001b[34m(self, key)\u001b[39m\n\u001b[32m 1182\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m._is_scalar_access(key):\n\u001b[32m 1183\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m.obj._get_value(*key, takeable=\u001b[38;5;28mself\u001b[39m._takeable)\n\u001b[32m-> \u001b[39m\u001b[32m1184\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_getitem_tuple\u001b[49m\u001b[43m(\u001b[49m\u001b[43mkey\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 1185\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[32m 1186\u001b[39m \u001b[38;5;66;03m# we by definition only have the 0th axis\u001b[39;00m\n\u001b[32m 1187\u001b[39m axis = \u001b[38;5;28mself\u001b[39m.axis \u001b[38;5;129;01mor\u001b[39;00m \u001b[32m0\u001b[39m\n",
"\u001b[36mFile \u001b[39m\u001b[32mc:\\Users\\romai\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\pandas\\core\\indexing.py:1377\u001b[39m, in \u001b[36m_LocIndexer._getitem_tuple\u001b[39m\u001b[34m(self, tup)\u001b[39m\n\u001b[32m 1374\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m._multi_take_opportunity(tup):\n\u001b[32m 1375\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m._multi_take(tup)\n\u001b[32m-> \u001b[39m\u001b[32m1377\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_getitem_tuple_same_dim\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtup\u001b[49m\u001b[43m)\u001b[49m\n",
"\u001b[36mFile \u001b[39m\u001b[32mc:\\Users\\romai\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\pandas\\core\\indexing.py:1020\u001b[39m, in \u001b[36m_LocationIndexer._getitem_tuple_same_dim\u001b[39m\u001b[34m(self, tup)\u001b[39m\n\u001b[32m 1017\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m com.is_null_slice(key):\n\u001b[32m 1018\u001b[39m \u001b[38;5;28;01mcontinue\u001b[39;00m\n\u001b[32m-> \u001b[39m\u001b[32m1020\u001b[39m retval = \u001b[38;5;28;43mgetattr\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mretval\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43mname\u001b[49m\u001b[43m)\u001b[49m\u001b[43m.\u001b[49m\u001b[43m_getitem_axis\u001b[49m\u001b[43m(\u001b[49m\u001b[43mkey\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43maxis\u001b[49m\u001b[43m=\u001b[49m\u001b[43mi\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 1021\u001b[39m \u001b[38;5;66;03m# We should never have retval.ndim < self.ndim, as that should\u001b[39;00m\n\u001b[32m 1022\u001b[39m \u001b[38;5;66;03m# be handled by the _getitem_lowerdim call above.\u001b[39;00m\n\u001b[32m 1023\u001b[39m \u001b[38;5;28;01massert\u001b[39;00m retval.ndim == \u001b[38;5;28mself\u001b[39m.ndim\n",
"\u001b[36mFile \u001b[39m\u001b[32mc:\\Users\\romai\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\pandas\\core\\indexing.py:1420\u001b[39m, in \u001b[36m_LocIndexer._getitem_axis\u001b[39m\u001b[34m(self, key, axis)\u001b[39m\n\u001b[32m 1417\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mhasattr\u001b[39m(key, \u001b[33m\"\u001b[39m\u001b[33mndim\u001b[39m\u001b[33m\"\u001b[39m) \u001b[38;5;129;01mand\u001b[39;00m key.ndim > \u001b[32m1\u001b[39m:\n\u001b[32m 1418\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\u001b[33m\"\u001b[39m\u001b[33mCannot index with multidimensional key\u001b[39m\u001b[33m\"\u001b[39m)\n\u001b[32m-> \u001b[39m\u001b[32m1420\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_getitem_iterable\u001b[49m\u001b[43m(\u001b[49m\u001b[43mkey\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43maxis\u001b[49m\u001b[43m=\u001b[49m\u001b[43maxis\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 1422\u001b[39m \u001b[38;5;66;03m# nested tuple slicing\u001b[39;00m\n\u001b[32m 1423\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m is_nested_tuple(key, labels):\n",
"\u001b[36mFile \u001b[39m\u001b[32mc:\\Users\\romai\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\pandas\\core\\indexing.py:1360\u001b[39m, in \u001b[36m_LocIndexer._getitem_iterable\u001b[39m\u001b[34m(self, key, axis)\u001b[39m\n\u001b[32m 1357\u001b[39m \u001b[38;5;28mself\u001b[39m._validate_key(key, axis)\n\u001b[32m 1359\u001b[39m \u001b[38;5;66;03m# A collection of keys\u001b[39;00m\n\u001b[32m-> \u001b[39m\u001b[32m1360\u001b[39m keyarr, indexer = \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_get_listlike_indexer\u001b[49m\u001b[43m(\u001b[49m\u001b[43mkey\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43maxis\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 1361\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m.obj._reindex_with_indexers(\n\u001b[32m 1362\u001b[39m {axis: [keyarr, indexer]}, copy=\u001b[38;5;28;01mTrue\u001b[39;00m, allow_dups=\u001b[38;5;28;01mTrue\u001b[39;00m\n\u001b[32m 1363\u001b[39m )\n",
"\u001b[36mFile \u001b[39m\u001b[32mc:\\Users\\romai\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\pandas\\core\\indexing.py:1558\u001b[39m, in \u001b[36m_LocIndexer._get_listlike_indexer\u001b[39m\u001b[34m(self, key, axis)\u001b[39m\n\u001b[32m 1555\u001b[39m ax = \u001b[38;5;28mself\u001b[39m.obj._get_axis(axis)\n\u001b[32m 1556\u001b[39m axis_name = \u001b[38;5;28mself\u001b[39m.obj._get_axis_name(axis)\n\u001b[32m-> \u001b[39m\u001b[32m1558\u001b[39m keyarr, indexer = \u001b[43max\u001b[49m\u001b[43m.\u001b[49m\u001b[43m_get_indexer_strict\u001b[49m\u001b[43m(\u001b[49m\u001b[43mkey\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43maxis_name\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 1560\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m keyarr, indexer\n",
"\u001b[36mFile \u001b[39m\u001b[32mc:\\Users\\romai\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\pandas\\core\\indexes\\base.py:6200\u001b[39m, in \u001b[36mIndex._get_indexer_strict\u001b[39m\u001b[34m(self, key, axis_name)\u001b[39m\n\u001b[32m 6197\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[32m 6198\u001b[39m keyarr, indexer, new_indexer = \u001b[38;5;28mself\u001b[39m._reindex_non_unique(keyarr)\n\u001b[32m-> \u001b[39m\u001b[32m6200\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_raise_if_missing\u001b[49m\u001b[43m(\u001b[49m\u001b[43mkeyarr\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mindexer\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43maxis_name\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 6202\u001b[39m keyarr = \u001b[38;5;28mself\u001b[39m.take(indexer)\n\u001b[32m 6203\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(key, Index):\n\u001b[32m 6204\u001b[39m \u001b[38;5;66;03m# GH 42790 - Preserve name from an Index\u001b[39;00m\n",
"\u001b[36mFile \u001b[39m\u001b[32mc:\\Users\\romai\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\pandas\\core\\indexes\\base.py:6249\u001b[39m, in \u001b[36mIndex._raise_if_missing\u001b[39m\u001b[34m(self, key, indexer, axis_name)\u001b[39m\n\u001b[32m 6247\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m nmissing:\n\u001b[32m 6248\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m nmissing == \u001b[38;5;28mlen\u001b[39m(indexer):\n\u001b[32m-> \u001b[39m\u001b[32m6249\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mKeyError\u001b[39;00m(\u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[33mNone of [\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mkey\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m] are in the [\u001b[39m\u001b[38;5;132;01m{\u001b[39;00maxis_name\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m]\u001b[39m\u001b[33m\"\u001b[39m)\n\u001b[32m 6251\u001b[39m not_found = \u001b[38;5;28mlist\u001b[39m(ensure_index(key)[missing_mask.nonzero()[\u001b[32m0\u001b[39m]].unique())\n\u001b[32m 6252\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mKeyError\u001b[39;00m(\u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mnot_found\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m not in index\u001b[39m\u001b[33m\"\u001b[39m)\n",
"\u001b[31mKeyError\u001b[39m: \"None of [Index(['v'], dtype='object')] are in the [columns]\""
]
}
],
"source": [
"import dataframe_image as dfi\n",
"styled = v1df.style \\\n",
" .set_table_styles([{'selector': 'th', 'props': [('font-size', '12pt')]}]) \\\n",
" .background_gradient(subset=['v'], cmap='Blues')\n",
"\n",
"# export to PNG\n",
"dfi.export(styled, 'v1df.png')\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "48e20572",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python313",
"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.13.2"
}
},
"nbformat": 4,
"nbformat_minor": 5
}