Created
October 6, 2018 23:07
-
-
Save wuerges/8d69954257ab51ad4128abf9e12d2618 to your computer and use it in GitHub Desktop.
Gerar gráfico /r/brasilivre
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import pandas as pd | |
import numpy as np | |
data = pd.read_csv("Censo /r/brasilivre 2018.csv") | |
# | |
# print(data.columns) | |
# | |
# data['Idade'] | |
# | |
# # count, division = np.histogram(data['Idade'][1]) | |
# | |
# division = np.arange(0, 100, 5) | |
# | |
# data['Idade'].hist(bins=division) | |
# | |
# data.groupby(['Sexo']).size().plot.pie() | |
# | |
# renda = data['Renda individual'].dropna() | |
# renda.plot.hist(bins=np.arange(0, 30000, 1000)) | |
# | |
# data.groupby(['Orientação sexual']).size().plot.bar() | |
eps = pd.DataFrame(data.groupby(['Espectro político', 'Espectro social']).size()).reset_index() | |
eps.columns | |
eps['Espectro político'] = eps['Espectro político'] - 5 | |
eps['Espectro social'] = eps['Espectro social'] - 5 | |
plot = eps.plot.scatter(figsize=(10,10), x='Espectro político', y='Espectro social', c=0, sharex=False #colormap='gray' | |
,title="Compasso Político", yticks=np.arange(-5, 6), xticks=np.arange(-5, 6)) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment