<jupyter_start><jupyter_text><jupyter_code>import pandas as pd
import altair as alt
url = 'https://raw.githubusercontent.com/spendnetwork/charts/master/contracts_data_deloitte.csv'
df = pd.read_csv(url)
#print(df)
df['releasedate']=pd.to_datetime(df['releasedate']).dt.strftime('%m/%d/%Y')
df1=(df.groupby('releasedate').agg({'ocid': ['count'], 'aw_value': 'sum'}))
#df1.head()
df1.columns = df1.columns.map('_'.join)
df1 = df1.reset_index()
#df1.head()
#df1['releasedate']=pd.to_datetime(df1['releasedate'].dt.strftime('%m/%d/%Y'))
#df1['releasedate']=pd.to_datetime(df1['releasedate']).dt.strftime('%m/%d/%Y') 
#df1.head()
  nearest = alt.selection(type='single', nearest=True, on='mouseover',fields=['releasedate'], empty='none')
        line=alt.Chart(df1, width=1200, height=250, title="Count of contracts of Deloitte LLP").mark_line(color='#91D739').encode(
            x=alt.X('yearmonth(releasedate):O',
                    axis=alt.Axis(tickCount=12, title="https://openopps.com", 
                grid=False, 
                labelFont='Helvetica', 
                labelFontSize=12, 
                labelAngle=0, 
                titleAlign='left',
                titleAnchor='start',
                titleFont='Helvetica',
                titleFontSize= 11,
                titleFontWeight= 300,
                titleX= -0,
                titleY= 30) 
                   ),
            y=alt.Y('sum(ocid_count):Q',
                     axis=alt.Axis(title="",
                                    format=".0s",)
                   ),
            )
        selectors = alt.Chart(df1).mark_point().encode(
            x='yearmonth(releasedate):O',
            opacity=alt.value(0),
        ).add_selection(
            nearest
        )

        points = line.mark_point().encode(
            opacity=alt.condition(nearest, alt.value(1), alt.value(0))
        )


        text = line.mark_text(align='left', dx=10, dy=-10).encode(
            text=alt.condition(nearest, 'sum(ocid_count):Q', alt.value(' '))
        )

        rules = alt.Chart(df1).mark_rule(color='gray').encode(
            x='yearmonth(releasedate):O',
        ).transform_filter(
            nearest
        )

        chart = alt.layer(
            line, selectors, points, rules, text
        ).configure_view(
          strokeWidth=0
        ).configure_title(fontSize=18, anchor='start',
                color= "#91D739", font='Helvetica', fontWeight=400)

        chart<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16278135048231512, 'fraction_numerical': 0.023713826366559485, 'mean_word_length': 2.2199223803363517, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '83516', 'license': 'Apache-2.0', 'n_tokens_mistral': 851, 'n_tokens_neox': 784, 'n_words': 101, 'path': 'charts/number_of_contracts_with_deloitte_chart_opensourced.ipynb', 'repo_name': 'ErinClark/bmbv-better-markets-better-value', 'size': '2488'}