<jupyter_start><jupyter_text>**Country Distribution**Visualise how loans are distributed by country.<jupyter_code>%matplotlib inline
import plotly.graph_objs as go
import plotly.offline as py
py.init_notebook_mode(connected=True)
large_counts = kiva_df['country'].value_counts().head(50)
trace = go.Bar(
    y=large_counts.index[::-1],
    x=large_counts.values[::-1],
    orientation='h'
)
layout = go.Layout(
    title='Country Distribution of Loans',
    width=700,
    height=1000
)

figure = go.Figure(data=[trace], layout=layout)
py.iplot(figure, filename="CountryLoan")<jupyter_output><empty_output><jupyter_text>**Plotly ColorMap for Countries**<jupyter_code>map_df = kiva_df['country'].value_counts().to_frame().reset_index()
map_df.columns = ['country', 'loan_count']
map_plot_data = [
    {
        'type': 'choropleth',
        'locations': map_df['country'],
        'locationmode': 'country names',
        'z': map_df['loan_count'],
        'text': map_df['country'],
        'autocolorscale': True
    }
]
map_plot_layout = {
    'title': 'Loans By Country'
}
map_plot_fig = {'data': map_plot_data, 'layout': map_plot_layout}
py.iplot(map_plot_fig, filename='loan_world_map')<jupyter_output><empty_output><jupyter_text>**Explore Sector Distribution**<jupyter_code>def distribution_by_bar(series_df, title):
    trace = go.Bar(
        y=series_df.index[::-1],
        x=series_df.values[::-1],
        orientation='h'
    )
    layout = go.Layout(
        title=title,
        width=700,
        height=1000
    )

    figure = go.Figure(data=[trace], layout=layout)
    py.iplot(figure, filename=title)
distribution_by_bar(kiva_df['sector'].value_counts(), 'LoanBySector')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1518324607329843, 'fraction_numerical': 0.011634671320535195, 'mean_word_length': 4.733333333333333, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '611173', 'license': 'MIT', 'n_tokens_mistral': 630, 'n_tokens_neox': 608, 'n_words': 92, 'path': 'kiva_crowdfunding.ipynb', 'repo_name': 'amitkumarj441/notebooks', 'size': '1719'}