<jupyter_start><jupyter_text>Partenaires de production  Pour un spectacleId voir les coproductions<jupyter_code>#pour un spectacle voir les coproductions
#https://www.lesarchivesduspectacle.net/?IDX_Spectacle=90517#spectacle-partenaires-de-production
#Perchée dans les arbres 8 coproductions 

import urllib.request
import re
import pandas as pd
# import the BeautifulSoup library so we can parse HTML and XML documents
from bs4 import BeautifulSoup
#spectacleId="34525"
spectacleId="36956"
#spectacleId="90517"
# specify which URL/web page we are going to be scraping
url = "https://www.lesarchivesduspectacle.net/?IDX_Spectacle=" + spectacleId +"#spectacle-partenaires-de-production"
# open the url using urllib.request and put the HTML into the page variable
page = urllib.request.urlopen(url)
# parse the HTML from our URL into the BeautifulSoup parse tree format
soup = BeautifulSoup(page, "lxml")
#the div where the information is
#the div where the information is
table = soup.find('table', class_='f-spectacle__production-bis') 
# Down below we'll add our inmates to this list
inmates_list = []

# BeautifulSoup provides nice ways to access the data in the parsed
# page. Here, we'll use the select method and pass it a CSS style
# selector to grab all the rows in the table (the rows contain the 
# inmate names and ages).

for table_row in table.find_all('tr'):
    # Each tr (table row) has three td HTML elements (most people 
    # call these table cels) in it (first name, last name, and age)
    cells = table_row.findAll('td')
    # Our table has one exception -- a row without any cells.
    # Let's handle that special case here by making sure we
    # have more than zero cells before processing the cells
    if len(cells) > 0:
        organism = cells[1].text.strip()
        organism_element = cells[1].find('a',class_='c_Organisme b')
        organismId = organism_element['href'].replace("?IDX_Organisme=","")
        type_aide = cells[0].text.strip()
        if(type_aide != ''):
            type_aide_master = type_aide
        
        else:
            type_aide = type_aide_master
        inmate = {'performanceId': spectacleId,'type_aide': type_aide,'organism': organism,'organismId': organismId}
        inmates_list.append(inmate)

df = pd.DataFrame(inmates_list)
df<jupyter_output><empty_output><jupyter_text>Fonction qui retourne les types d'aide<jupyter_code>#function return dataframe with type_aide and organism
import urllib.request
import re
# import the BeautifulSoup library so we can parse HTML and XML documents
from bs4 import BeautifulSoup
import pandas as pd
import socket

def import_df_type_production(spectacleId,saison):
    # specify which URL/web page we are going to be scraping
    url = "https://www.lesarchivesduspectacle.net/?IDX_Spectacle=" + spectacleId +"#spectacle-partenaires-de-production"
    try:
        page = urllib.request.urlopen(url)
        # parse the HTML from our URL into the BeautifulSoup parse tree format
        soup = BeautifulSoup(page, "lxml")
        table = soup.find('table', class_='f-spectacle__production-bis') 
        # Down below we'll add our inmates to this list
        inmates_list = []
        if table is not None:
            for table_row in table.find_all('tr'):
                if table_row is not None:
                    cells = table_row.findAll('td')
                    if len(cells) > 0:
                        organism = cells[1].text.strip()
                        organism_element = cells[1].find('a',class_='c_Organisme b')
                        organismId = organism_element['href'].replace("?IDX_Organisme=","")
                        type_aide = cells[0].text.strip()
                        if(type_aide != ''):
                            type_aide_master = type_aide 
                        else:
                            type_aide = type_aide_master
                        inmate = {'performanceId': spectacleId,'type_aide': type_aide,'organism': organism,'organismId': organismId,'saison':saison}
                        inmates_list.append(inmate)
                    else:
                        inmate = {'performanceId': spectacleId,'type_aide': '','organism': '','organismId': '','saison':saison}
                        inmates_list.append(inmate) 
            df = pd.DataFrame(inmates_list)
            return df
        else:
            inmate = {'performanceId': spectacleId,'type_aide': '','organism': '','organismId': '','saison':saison}
            inmates_list.append(inmate)
            df = pd.DataFrame(inmates_list)
            return df
    except urllib.error.URLError as e:
        print(e.reason + "for spectacleId "  + spectacleId + " saison " + saison)
    except socket.timeout as e: # <-------- this block here
        print("We timed out")<jupyter_output><empty_output><jupyter_text>Génération des types d'aide pour un organisme donné  Arsenal<jupyter_code>#Pour les spectacles à l'Arsenal voir les types d'aide
# ORGANISM ID DE L'ETUDE
# 439 Arsenal
# 699 CCAM [Centre culturel André Malraux] - Scène Nationale de Vandoeuvre-lès-Nancy
# 383 Grand théâtre du Luxembourg
# 1914 <NAME> 
import time
from datetime import datetime
import pandas as pd
organismId="439"
csv_file_path = os.getcwd() + "/data/all_10_years_organism_"+ organismId + "_danse.csv"
df_organism = pd.read_csv(csv_file_path)
df = pd.DataFrame(columns=['performanceId','type_aide','organism','organismId'])                        
print("start",datetime.now()) 
for row in df_organism.itertuples():
    if (row.performanceId!=0):
        #call the function to have the type_aide and orgnaism
        try:
            df=df.append(import_df_type_production(str(row.performanceId),row.year),sort=False,ignore_index=True)
        except Exception as err:
            continue
df.to_csv(os.getcwd() + "/data/all_10_years_organism_" + organismId + "_type_production_danse.csv")

print("finish",datetime.now())<jupyter_output>start 2020-08-23 13:21:36.771744
finish 2020-08-23 13:22:32.446713<jupyter_text>CCAM<jupyter_code>import time
import os
from datetime import datetime
import pandas as pd
organismId="699"
csv_file_path = os.getcwd() + "/data/all_10_years_organism_"+ organismId + "_danse.csv"
df_organism = pd.read_csv(csv_file_path)
df = pd.DataFrame(columns=['performanceId','type_aide','organism','organismId'])                        
print("start",datetime.now()) 
for row in df_organism.itertuples():
    if (row.performanceId!=0):
        #call the function to have the type_aide and orgnaism
        try:
            df=df.append(import_df_type_production(str(row.performanceId),row.year),sort=False,ignore_index=True)
        except Exception as err:
            continue
df.to_csv(os.getcwd() + "/data/all_10_years_organism_" + organismId + "_type_production_danse.csv")

print("finish",datetime.now())<jupyter_output>start 2020-08-27 18:50:56.037006
finish 2020-08-27 18:51:34.130561<jupyter_text>Carreau<jupyter_code>import time
import os
from datetime import datetime
import pandas as pd
organismId="1914"
csv_file_path = os.getcwd() + "/data/all_10_years_organism_"+ organismId + "_danse.csv"
df_organism = pd.read_csv(csv_file_path)
df = pd.DataFrame(columns=['performanceId','type_aide','organism','organismId'])                        
print("start",datetime.now()) 
for row in df_organism.itertuples():
    if (row.performanceId!=0):
        #call the function to have the type_aide and orgnaism
        try:
            df=df.append(import_df_type_production(str(row.performanceId),row.year),sort=False,ignore_index=True)
        except Exception as err:
            continue
df.to_csv(os.getcwd() + "/data/all_10_years_organism_" + organismId + "_type_production_danse.csv")

print("finish",datetime.now())<jupyter_output><empty_output><jupyter_text>Grand théâtre<jupyter_code>import time
import os
from datetime import datetime
import pandas as pd
organismId="383"
csv_file_path = os.getcwd() + "/data/all_10_years_organism_"+ organismId + "_danse.csv"
df_organism = pd.read_csv(csv_file_path)
df = pd.DataFrame(columns=['performanceId','type_aide','organism','organismId'])                        
print("start",datetime.now()) 
for row in df_organism.itertuples():
    if (row.performanceId!=0):
        #call the function to have the type_aide and orgnaism
        try:
            df=df.append(import_df_type_production(str(row.performanceId),row.year),sort=False,ignore_index=True)
        except Exception as err:
            continue
df.to_csv(os.getcwd() + "/data/all_10_years_organism_" + organismId + "_type_production_danse.csv")

print("finish",datetime.now())<jupyter_output>start 2020-08-27 20:54:55.664130
finish 2020-08-27 20:56:59.869368<jupyter_text>Evolution des coproductions par organisme  Grand théâtre<jupyter_code>import time
from datetime import datetime
import pandas as pd
import os
organismId=383
csv_file_path = os.getcwd() + "/data/all_10_years_organism_" + str(organismId) +"_type_production_danse.csv"
df_type_production_lux = pd.read_csv(csv_file_path)

df_type_production_lux = df_type_production_lux[df_type_production_lux['type_aide'] == 'Coproduction']

#where coproduction est Lux
df_type_production_lux = df_type_production_lux[df_type_production_lux['organismId'] == organismId]

csv_file_path_danse = os.getcwd() + "/data/all_10_years_organism_"+ str(organismId) + "_danse.csv"
df_danse = pd.read_csv(csv_file_path_danse)
df_copro_lux = df_danse[df_danse['performanceId'].isin(df_type_production_lux['performanceId'])]
#df_copro_lux =df_copro_lux.groupby(["year"]).performanceId.count()

df_copro_lux

#moyenne_copro = df_copro_lux.performanceId.count().mean() / 10
#moyenne_copro<jupyter_output><empty_output><jupyter_text>Arsenal<jupyter_code>import time
from datetime import datetime
import pandas as pd
import os
organismId=439
csv_file_path = os.getcwd() + "/data/all_10_years_organism_" + str(organismId) +"_type_production_danse.csv"
df_type_production_arsenal = pd.read_csv(csv_file_path)

df_type_production_arsenal = df_type_production_arsenal[df_type_production_arsenal['type_aide'] == 'Coproduction']

#where coproduction est Lux
df_type_production_arsenal = df_type_production_arsenal[df_type_production_arsenal['organismId'] == organismId]

csv_file_path_danse = os.getcwd() + "/data/all_10_years_organism_"+ str(organismId) + "_danse.csv"
df_danse = pd.read_csv(csv_file_path_danse)
df_copro_arsenal = df_danse[df_danse['performanceId'].isin(df_type_production_arsenal['performanceId'])]
#df_copro_arsenal=df_copro_arsenal.groupby(["author"]).performanceId.count().sort_values(ascending=False) 
#df_copro_arsenal=df_copro_arsenal.groupby(["year"]).performanceId.count()
#moyenne_copro = df_copro_arsenal.performanceId.count().mean() / 10
#moyenne_copro 

df_copro_arsenal
csv_file_path_danse = os.getcwd() + "/data/all_10_years_organism_"+ str(organismId) + "_danse.csv"
df_danse = pd.read_csv(csv_file_path_danse)
df_copro_arsenal = df_danse[df_danse['authordId'].isin([8590,7929])]
df_copro_arsenal
import pandas as pd
import matplotlib.pyplot as plt
import os
fig, ax = plt.subplots(figsize=(8,6))


ax= df_copro_arsenal.plot.pie(labeldistance=1.10)
ax.set_title("Chorégraphes ayant bénéficié de coproduction par L'Arsenal")
ax.set_ylabel('')


fig = ax.get_figure()
fig.savefig(os.getcwd() + "/data/arsenal_copro_danse.png")
plt.clf()<jupyter_output><empty_output><jupyter_text>Type d'aide filtre danse<jupyter_code>import time
from datetime import datetime
import pandas as pd
import os
# ORGANISM ID DE L'ETUDE
# 439 Arsenal
# 699 CCAM [Centre culturel André Malraux] - Scène Nationale de Vandoeuvre-lès-Nancy
# 383 Grand théâtre du Luxembourg
# 1914 <NAME>  

# Arsenal 439
organismId=699
csv_file_path = os.getcwd() + "/data/all_10_years_organism_" + str(organismId) +"_type_production_danse.csv"
df_type_production_arsenal = pd.read_csv(csv_file_path)

#df_type_production_arsenal = df_type_production_arsenal[df_type_production_arsenal['type_aide'] == 'Résidence']

#where coproduction est Lux
#df_type_production_arsenal = df_type_production_arsenal[df_type_production_arsenal['organismId'] == organismId]

csv_file_path_danse = os.getcwd() + "/data/all_10_years_organism_"+ str(organismId) + "_danse.csv"
df_danse = pd.read_csv(csv_file_path_danse)
df_type_aide_arsenal = df_type_production_arsenal[df_type_production_arsenal['performanceId'].isin(df_danse['performanceId'])]
#df_copro_arsenal=df_copro_arsenal.groupby(["year"]).performanceId.count()
df_type_aide_arsenal = df_type_aide_arsenal[df_type_aide_arsenal['organismId'] == organismId]
#df_type_aide_arsenal = df_type_aide_arsenal[df_type_aide_arsenal['type_aide'] == 'Résidence']
#len(df_type_aide_arsenal)

#df_type_aide_arsenal
df_type_aide_arsenal.type_aide.value_counts()

len(df_copro_arsenal)

filterCommonPoleSudManege = [22187,86085,28889,50529,51077,66193]
df_copro_arsenal = df_copro_arsenal[df_copro_arsenal.performanceId.isin(filterCommonPoleSudManege)]
df_copro_arsenal<jupyter_output><empty_output><jupyter_text>CCAM<jupyter_code>import time
from datetime import datetime
import pandas as pd
import os
organismId=699
csv_file_path = os.getcwd() + "/data/all_10_years_organism_" + str(organismId) +"_type_production_danse.csv"
df_type_production_ccam = pd.read_csv(csv_file_path)

df_type_production_ccam = df_type_production_ccam[df_type_production_ccam['type_aide'] == 'Coproduction']


df_type_production_ccam = df_type_production_ccam[df_type_production_ccam['organismId'] == organismId]

csv_file_path_danse = os.getcwd() + "/data/all_10_years_organism_"+ str(organismId) + "_danse.csv"
df_danse = pd.read_csv(csv_file_path_danse)
df_copro_ccam = df_danse[df_danse['performanceId'].isin(df_type_production_ccam['performanceId'])]
#df_copro_ccam=df_copro_ccam.groupby(["year"]).performanceId.count()
moyenne_copro = df_copro_ccam.performanceId.count().mean() / 10
moyenne_copro<jupyter_output><empty_output><jupyter_text>Detail par année pour voir le type de spectacle<jupyter_code>import time
from datetime import datetime
import pandas as pd
import os
organismId=699
#organismId=439
csv_file_path = os.getcwd() + "/data/all_10_years_organism_" + str(organismId) +"_type_production_danse.csv"
df_copro_ccam = pd.read_csv(csv_file_path)
df_copro_ccam = df_copro_ccam[df_copro_ccam['type_aide'] == 'Coproduction']
df_copro_ccam = df_copro_ccam[df_copro_ccam['organismId'] == organismId]<jupyter_output><empty_output><jupyter_text>Faut peut-être regarder du côté des créations<jupyter_code>csv_file_path_danse = os.getcwd() + "/data/all_10_years_organism_"+ str(organismId) + "_danse.csv"
df_danse = pd.read_csv(csv_file_path_danse)
df_danse_creation_ccam= df_danse[df_danse['organismeName'] == 'CCAM']
len(df_danse_creation_ccam)
#### Les créations qui ne sont pas des coproductions?
df_copro_ccam_creation = df_danse_creation_ccam[~df_danse_creation_ccam['performanceId'].isin(df_copro_ccam['performanceId'])]
df_copro_ccam_creation<jupyter_output><empty_output><jupyter_text>Carreau<jupyter_code>import time
from datetime import datetime
import pandas as pd
organismId=1914
csv_file_path = os.getcwd() + "/data/all_10_years_organism_" + str(organismId) +"_type_production_danse.csv"
df_type_production_carreau = pd.read_csv(csv_file_path)

df_type_production_carreau = df_type_production_carreau[df_type_production_carreau['type_aide'] == 'Coproduction']

df_type_production_carreau
df_type_production_carreau = df_type_production_carreau[df_type_production_carreau['organismId'] == organismId]

csv_file_path_danse = os.getcwd() + "/data/all_10_years_organism_"+ str(organismId) + "_danse.csv"
df_danse = pd.read_csv(csv_file_path_danse)
df_copro_carreau = df_danse[df_danse['performanceId'].isin(df_type_production_carreau['performanceId'])]
#df_copro_carreau=df_copro_carreau.groupby(["year"]).performanceId.count()
#df_copro_carreau
moyenne_copro = df_copro_carreau.performanceId.count().mean() / 10
moyenne_copro
import time
from datetime import datetime
import pandas as pd
organismId=439
csv_file_path = os.getcwd() + "/data/all_10_years_organism_" + str(organismId) +"_type_production_danse.csv"
df_type_production_carreau = pd.read_csv(csv_file_path)

df_type_production_carreau = df_type_production_carreau[df_type_production_carreau['type_aide'] == 'Résidence']

df_type_production_carreau
#Coproduction arsenal
#saison
#2010.0    1
#2011.0    6
#2012.0    4
#2013.0    2
#2014.0    4
#2015.0    1
#2016.0    1
#2017.0    3
#2018.0    3



#2010    17
#2011    19
#2012    15
#2013    12
#2014    20
#2015    13
#2016    22
#2017    19
#2018    31
#2019    27
import time
from datetime import datetime
import pandas as pd
csv_file_path = "all_10_years_organism_439_type_production.csv"
df_type_production = pd.read_csv(csv_file_path)
df_type_production.type_aide.value_counts()<jupyter_output><empty_output><jupyter_text>Histogramme qui reprend les coproductions<jupyter_code>2010    1
2011    2
2012    5
2013    1
2014    1
2018    2
2019    1
x=[2010,2011,2012,2013,2014,2015,2016,2017,2018,2019]
y_lux=[1,2,5,1,1,0,0,0,2,1]
import pandas as pd
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(8,6))


plt.plot(df_copro_lux,label="Grand théâtre",linestyle='-', marker='o')
plt.plot(df_copro_ccam,label="CCAM",linestyle='-', marker='o')
plt.plot(df_copro_carreau,alpha=0.5, label="Carreau",linestyle='-', marker='o')
plt.plot(df_copro_arsenal,label="Arsenal",linestyle='-', marker='o')


plt.xlabel("Année")
plt.ylabel("Nb coproductions")
plt.title('Nombre de coproductions par an')
plt.legend(loc='upper right')
#plt.legend(["Grand théâtre","CCAM","Carreau","Arsenal"])



fig = ax.get_figure()
fig.savefig(os.getcwd() + "/data/nb_coproduction_structure.png")
plt.clf()
import time
from datetime import datetime
import pandas as pd
csv_file_path = "all_10_years_organism_439_type_production.csv"
df_type_production = pd.read_csv(csv_file_path)
#where organism is Arsenal
df_type_production = df_type_production[df_type_production['organismId'] == 439.0]
df_type_production.type_aide.value_counts()
#df_type_production.nunique()
#df_type_production<jupyter_output><empty_output><jupyter_text>Coréalisation<jupyter_code>import time
from datetime import datetime
import pandas as pd
import os
organismId=439
csv_file_path = os.getcwd() + "/data/all_10_years_organism_" + str(organismId) +"_type_production_danse.csv"
df_type_production_arsenal = pd.read_csv(csv_file_path)

df_type_production_arsenal = df_type_production_arsenal[df_type_production_arsenal['type_aide'] == 'Coproduction']

#where coproduction est Lux
#df_type_production_arsenal = df_type_production_arsenal[df_type_production_arsenal['organismId'] == organismId]

csv_file_path_danse = os.getcwd() + "/data/all_10_years_organism_"+ str(organismId) + "_danse.csv"
df_danse = pd.read_csv(csv_file_path_danse)
df_copro_arsenal = df_danse[df_danse['performanceId'].isin(df_type_production_arsenal['performanceId'])]
df_copro_arsenal=df_copro_arsenal.groupby(["year"]).performanceId.count()
df_copro_arsenal<jupyter_output><empty_output><jupyter_text>Moyenne de coproduction par spectacle<jupyter_code>import time
from datetime import datetime
import pandas as pd
csv_file_path = "all_10_years_organism_439_type_production.csv"
df_type_production = pd.read_csv(csv_file_path)
#where organism is Arsenal
#df_type_production = df_type_production[df_type_production['organismId'] == 383.0]
#df_type_production.type_aide.value_counts()
#df_type_production.nunique()
#df_type_production.nunique()
#df_type_production.type_aide.value_counts()

#df_type_production.set_index(['performanceId'], drop=True, inplace=True)
#df_type_production.groupby(["type_aide"]).type_aide.count().sort_values(ascending=False)


df_type_production = df_type_production[df_type_production['type_aide'] == 'Coproduction']
#df_type_production.groupby(["performanceId"]).type_aide.count().sort_values(ascending=False)

df_type_production.groupby(["performanceId"]).type_aide.count().mean()
##33 performance en coproduction faite par l'institution passée en paramètre sur 476 performances Luxembourg
## 6 performance en coproduction 192  Arsenal 

#moyenne de coprodcutuion 4.48
#moyenne de coprodcutuion si Arsenael faut selectionner les performanceId si organismId == arsenal
# et ces performznceId les sélectionner dans dataframe origiine et group by 

#df_type_production.nunique()
import time
from datetime import datetime
import pandas as pd
csv_file_path = "all_10_years_organism_439_type_production.csv"
df_type_production = pd.read_csv(csv_file_path)
df_type_production[df_type_production['type_aide'].isnull().values].nunique()<jupyter_output><empty_output><jupyter_text>DRAC - Soutien - Aide  DRAC Arsenal<jupyter_code>import time
from datetime import datetime
import pandas as pd
organismId="439"
csv_file_path = os.getcwd() + "/data/all_10_years_organism_" + organismId + "_type_production_danse.csv"
df_type_production = pd.read_csv(csv_file_path)

#df_type_production = df_type_production[df_type_production['type_aide'] == 'Soutien']
df_type_production = df_type_production[df_type_production['type_aide'].isin(['Aide','Soutien'])] 

df_soutien_drac=df_type_production[df_type_production['organismId'].isin(['712.0','44731.0'])]
csv_file_path_danse = os.getcwd() + "/data/all_10_years_organism_"+ organismId + "_danse.csv"
df_danse = pd.read_csv(csv_file_path_danse)
df_danse_drac_arsenal = df_danse[df_danse['performanceId'].isin(df_soutien_drac['performanceId'])]
df_danse_drac_arsenal
#DRAC Lorraine IDX_Organisme=712
#DRAC Grand Est IDX_Organisme=44731<jupyter_output><empty_output><jupyter_text>DRAC CCAM<jupyter_code>import time
from datetime import datetime
import pandas as pd
import os
organismId="699"
csv_file_path = os.getcwd() + "/data/all_10_years_organism_" + organismId + "_type_production_danse.csv"
df_type_production = pd.read_csv(csv_file_path)
#df_type_production = df_type_production[df_type_production['type_aide'] == 'Soutien']
df_type_production = df_type_production[df_type_production['type_aide'].isin(['Aide','Soutien'])] 
df_soutien_drac=df_type_production[df_type_production['organismId'].isin(['712.0','44731.0'])]
csv_file_path_danse = os.getcwd() + "/data/all_10_years_organism_"+ organismId + "_danse.csv"
df_danse = pd.read_csv(csv_file_path_danse)
df_danse_drac_ccam = df_danse[df_danse['performanceId'].isin(df_soutien_drac['performanceId'])]
df_danse_drac_ccam
### DRAC Carreau
import time
from datetime import datetime
import pandas as pd
import os
organismId="1914"
csv_file_path = os.getcwd() + "/data/all_10_years_organism_" + organismId + "_type_production_danse.csv"
df_type_production = pd.read_csv(csv_file_path)
#df_type_production = df_type_production[df_type_production['type_aide'] == 'Soutien']
df_type_production = df_type_production[df_type_production['type_aide'].isin(['Aide','Soutien'])] 
df_soutien_drac= df_type_production[df_type_production['organismId'].isin(['712.0','44731.0'])]
df_soutien_drac
csv_file_path_danse = os.getcwd() + "/data/all_10_years_organism_"+ organismId + "_danse.csv"
df_danse = pd.read_csv(csv_file_path_danse)
df_danse_drac_carreau = df_danse[df_danse['performanceId'].isin(df_soutien_drac['performanceId'])]
df_danse_drac_carreau
df_danse_drac_carreau
df_danse_drac_ccam
df_danse_drac_arsenal<jupyter_output><empty_output><jupyter_text>Organisme qui programme le plus les compagnies soutenues par les DRAC<jupyter_code>import matplotlib.pyplot as plt
data_frames = pd.concat([df_danse_drac_carreau, df_danse_drac_ccam, df_danse_drac_arsenal])
#data_frames['organismeName'][1914] = 'Le Carreau'
data_frames['organism'] = ""
data_frames.loc[data_frames.organism_id == 1914, 'organism'] = 'Le Carreau'
data_frames.loc[data_frames.organism_id == 699, 'organism'] = 'CCAM'
data_frames.loc[data_frames.organism_id == 439, 'organism'] = 'Arsenal'
fig, ax = plt.subplots(figsize=(6,6))
ax=data_frames.groupby("organism")["authordId"].count().sort_values(ascending=False).head(5).plot.pie(autopct='%1.1f%%')

ax.set_title('Qui programme les compagnies soutenues par la DRAC')
fig = ax.get_figure()
fig.savefig(os.getcwd() + "/data/organism_choregraphe_DRAC_aide_soutien.png")
plt.clf()
fig, ax = plt.subplots(figsize=(6,6))
data_frames.groupby("author")["performanceId"].count().sort_values(ascending=False).plot.pie(autopct='%1.1f%%')
ax.set_title('Chorégraphes soutenues par la DRAC')
fig = ax.get_figure()
#some space for the xlabel
plt.tight_layout()
fig.savefig(os.getcwd() + "/data/choregraphes_DRAC_aide_soutien.png")
plt.clf()<jupyter_output><empty_output><jupyter_text>DRAC - Aide<jupyter_code>import time
from datetime import datetime
import pandas as pd
organismId="1914"
csv_file_path = os.getcwd() + "/data/all_10_years_organism_" + organismId + "_type_production_danse.csv"
df_type_production = pd.read_csv(csv_file_path)

df_type_production = df_type_production[df_type_production['type_aide'] == 'Aide']
df_soutien_drac=df_type_production[df_type_production['organismId'].isin(['712.0','44731.0'])]
csv_file_path_danse = os.getcwd() + "/data/all_10_years_organism_"+ organismId + "_danse.csv"
df_danse = pd.read_csv(csv_file_path_danse)
df_danse_drac_arsenal = df_danse[df_danse['performanceId'].isin(df_soutien_drac['performanceId'])]
df_danse_drac_arsenal<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11381727456338363, 'fraction_numerical': 0.026454397845629876, 'mean_word_length': 6.188158269285511, 'pattern_counts': {'":': 0, '<': 81, '<?xml version=': 0, '>': 82, 'https://': 3, 'lorem ipsum': 0, 'www.': 3, 'xml': 2}, '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': '20', 'dir': 'jupyter-structured-clean-dedup', 'id': '526936', 'license': 'MIT', 'n_tokens_mistral': 9849, 'n_tokens_neox': 9132, 'n_words': 1543, 'path': 'notebooks/archives_spectacle/question_production_spectacle.ipynb', 'repo_name': 'eliselavy/ada-oxford', 'size': '25269'}