<jupyter_start><jupyter_text>Utilizzo delle licenze GateManager<jupyter_code>gateMan = lic[lic['Product'] == 'Client']
totGate = gateMan['Licenses'].values[0]
usedGate = gateMan['Used'].values[0]

usedAROL = app[app['Domain'] == 'TREE']
usedFT = app[app['Domain'] == 'COW']
usedOthers = app[~ ( (app['Domain'] == 'TREE') | (app['Domain'] == 'COW') )]

nAROL = len(usedAROL)
nFT = len(usedFT)
nOthers = len(usedOthers)

fig, ax = plt.subplots(1,2, figsize=(20,10))

def func(pct, total):
    # ricava il numero assoluto
    num = pct/100*total
    return '{:1.1f}%\n({:1.0f})'.format(pct, num)

# Torta utilizzo licenze
labels = ['Utilizzate', 'Libere']
percs = [usedGate*100/totGate, 100-usedGate*100/totGate]
explode = (0.1, 0.1)

ax[0].pie(percs, explode=explode,labels=labels, autopct=lambda x: func(x, totGate),
          shadow = True, textprops=dict(color='k', weight='bold', fontsize=20),
          colors = ['C3', 'C2'])
ax[0].legend(fontsize=15)
ax[0].set_title('Utilizzo licenze\n(Tot: {})'.format(totGate), size=25)

labels = 'TREE', 'COW', 'Altri'
percs = [nAROL*100/usedGate, nFT*100/usedGate, nOthers*100/usedGate]
explode = (0.1, 0.1, 0.1)  

ax[1].pie(percs, explode=explode,labels=labels, autopct=lambda x: func(x, usedGate),
           shadow = True, textprops=dict(color='k', weight='bold', fontsize=20),
          colors = ['C1', 'C2', 'C7'])
ax[1].legend(fontsize=15)
ax[1].set_title('Dettaglio licenze utilizzate\n(Tot: {})'.format(usedGate), size=25)
plt.show()
fig.savefig("Utilizzo_Licenze.pdf", dpi = 150, bbox_inches='tight')<jupyter_output><empty_output><jupyter_text>Stampa la lista degli utenti<jupyter_code># https://weasyprint.readthedocs.io/en/stable/install.html#windows
from weasyprint import HTML
def df2pdf(df, pdfName):
    df = df.reset_index(drop= True)
    df.index += 1
    html_out = df.to_html()
    HTML(string=html_out).write_pdf(pdfName, stylesheets=[stylesheet])

    
# Licenze Arol
df2pdf(usedAROL, 'TREE.pdf')
# Licenze FT
df2pdf(usedFT, 'COW.pdf')
# Alre licenze
df2pdf(usedOthers, 'Altri.pdf')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18978805394990367, 'fraction_numerical': 0.03564547206165703, 'mean_word_length': 5.572784810126582, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '533819', 'license': 'MIT', 'n_tokens_mistral': 879, 'n_tokens_neox': 847, 'n_words': 146, 'path': 'GenerateReport.ipynb', 'repo_name': 'SOLARMA/phb-reporting-tools', 'size': '2076'}