Last active
          September 5, 2018 16:50 
        
      - 
      
- 
        Save fcunhaneto/05f5593484a2b22fdb2fcc2249af005b to your computer and use it in GitHub Desktop. 
    Criando um histograma comparando os pesos masculino x feminino
  
        
  
    
      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 pandas as pd | |
| import matplotlib.pyplot as plt | |
| df = pd.read_csv('/home/francisco/Projects/Pycharm/' | |
| 'matplot-pandas-tutorial/files/questionario.csv') | |
| """ | |
| Criando um histograma comparando os pesos masculino x feminino | |
| """ | |
| fem = df[df.Sexo == 'F'] | |
| mas = df[df.Sexo == 'M'] | |
| peso_fem = fem['Peso'] | |
| peso_mas = mas['Peso'] | |
| plt.figure(figsize=(8, 6)) | |
| plt.title('Distribuição de Pesos') | |
| plt.xlabel('Peso') | |
| plt.ylabel('Alunos') | |
| plt.hist(peso_fem, bins=range(40, 110,10), | |
| alpha=0.5, label='feminino', color='#FF26E1') | |
| plt.hist(peso_mas, bins=range(40, 110,10), | |
| alpha=0.5, label='masculino', color='#2DB200') | |
| plt.legend(loc='upper right') | |
| plt.savefig('imagens/peso-histograma-mas-x-fem.png') | |
| plt.close() | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment