I'm using FPDF to generate reports with charts so I was thinking about using conditionals to use predeterminated text depending on the results from the df['COLUMN'].value_counts() with something like this:
This is a df, with multi-index generated using a for with value.counts() for each column, so what I would like to do is depending if the counts as in the example in Semi-Auto is the highest count do something like this:
from fpdf import FPDF
from datetime import datetime, timedelta
import os
if biggest_value_from_counts is == Semi-Auto use:
dummytext = "The most common transmission in the US is Semi-Auto becase blabla" + "\n"
dummytext += "line 2" + "\n"
dummytext += "line 3"
''' Second Page '''
pdf.add_page()
pdf.multi_cell(0, 5, dummytext)
pdf.output(filename, 'F')
It is possible?
index transmission
0 Automatic 22319
1 Manual 61308
2 Other 10
3 Semi-Auto 24903
df_index= df['columnname'].value_counts().idxmax()