# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# +
import pandas as pd
import numpy as np
import string

import seaborn as sns
import matplotlib.pyplot as plt
# %matplotlib inline

import plotly.tools as tls
import plotly.offline as py
from plotly.offline import init_notebook_mode, iplot, plot
import plotly.graph_objs as go
init_notebook_mode(connected=True)
import warnings
from collections import Counter

from sklearn.cross_validation import train_test_split

# machine learning
from sklearn.linear_model import LogisticRegression
from sklearn.svm import SVC, LinearSVC
from sklearn.ensemble import RandomForestClassifier
from sklearn.neighbors import KNeighborsClassifier
from sklearn.naive_bayes import GaussianNB
from sklearn.linear_model import SGDClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import BaggingClassifier
from sklearn.neural_network import MLPClassifier
#from sklearn.ensemble import AdaBoostClassifier3
from sklearn.ensemble import GradientBoostingClassifier
# -

# !pip install lightgbm

import lightgbm as lgb
from lightgbm import LGBMClassifier

# +
df = pd.read_csv('ks2018.csv')

df.head(5)

df.describe()

print(df.shape)
print(df.info())

print(df.nunique())

percentual_sucess = round(df["state"].value_counts() / len(df["state"]) * 100,2)

print("State Percentual in %: ")
print(percentual_sucess)

state = round(df["state"].value_counts() / len(df["state"]) * 100,2)

labels = list(state.index)
values = list(state.values)

trace1 = go.Pie(labels=labels, values=values, marker=dict(colors=['blue']))

layout = go.Layout(title='Distribuition of States', legend=dict(orientation="h"));

fig = go.Figure(data=[trace1], layout=layout)
iplot(fig)
# -

df['main_category'].value_counts().plot.bar(colormap='Paired')
plt.show()

# +
df['currency'].value_counts().plot.bar(colormap='Paired')
plt.show()

df['country'].value_counts().plot.bar(colormap='Paired')
plt.show()

StarcoderdataJupyterScriptsDedupFiltered