### imports

import pandas as pd
import matplotlib.pyplot as plt

### definitions

e12_series = [1.0, 1.2, 1.5, 1.8, 2.2, 2.7, 3.3, 3.9, 4.7, 5.6, 6.8, 8.2]

def mppc_volt(r1, r2): 
    return 1.175 * (1 + r1/r2)

def gen_df(series):
    l = []
    for r1 in series:
        for r2 in series:
            l.append((r1, r2, mppc_volt(r1, r2)))
    return pd.DataFrame(l, columns=["r1", "r2", "v_mppc"])

### generate df and plot

df = gen_df(e12_series)
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(13, 5))
for v in e12_series:
    filt = df['r1'] == v
    df.where(filt).dropna().plot(ax=ax1, x='v_mppc', y='r2', kind='line', label=v, marker='x')
    if v in e12_series[-3:]:
        df.where(filt).dropna().plot(ax=ax2, x='v_mppc', y='r2', kind='line', label=v, marker='x', logy=True)
### approximate solar panel voltage

r_sel = 8.2
dfs = df.round(2).where(df['r1'] == r_sel).dropna()
dfs['v_sol'] = dfs.v_mppc.apply(lambda row: round(row/0.75, 2))
dfs
r1r2v_mppcv_sol
8.21.010.8114.41
8.21.29.2012.27
8.21.57.6010.13
8.21.86.538.71
8.22.25.557.40
8.22.74.746.32
8.23.34.095.45
8.23.93.654.87
8.24.73.224.29
8.25.62.903.87
8.26.82.593.45
8.28.22.353.13