<filename>Data analysis/Function_bfy.py<gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Sun May  9 19:18:01 2021

@author: <NAME>
=============================
Visualização de indicadores fundamentalistas.

"""

import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd

tabela_df = pd.read_excel('D:/Arquivos Perssoais/Finanças/Planilha_automática.xlsx') 

#Tratando os valores para floats
for coluna in range(len(tabela_df.columns)-1):
    index = tabela_df.columns[coluna+1]
    
    def full_word(x):
        if x == '-' or x == '-%':    
            x = str(x.replace("-","NaN"))
        return x
    
    tabela_df[index] = tabela_df[index].apply(lambda x: (full_word(x)))
    tabela_df[index] = tabela_df[index].apply(lambda x: (x.replace("%","")))
    tabela_df[index] = tabela_df[index].apply(lambda x: (x.replace("R$","")))
    try:
        tabela_df[index] = tabela_df[index].apply(lambda x: float(x.replace(".","").replace(",",".")))    
    except:
        print('Something wrong!')

#Tratando os NaN
tabela_df = tabela_df.fillna(0)

#plots
for coluna in range(len(tabela_df.columns)-1):
    index = tabela_df.columns[coluna+1]
    
    fig, ax = plt.subplots()
    sns.barplot(x='Ativo', y=tabela_df[index], data=tabela_df)
    plt.ylim(-10, 50)
    print(coluna)







<filename>Data analysis/Function_bfy.py<gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Sun May  9 19:18:01 2021

@author: <NAME>
=============================
Visualização de indicadores fundamentalistas.

"""

import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd

tabela_df = pd.read_excel('D:/Arquivos Perssoais/Finanças/Planilha_automática.xlsx') 

#Tratando os valores para floats
for coluna in range(len(tabela_df.columns)-1):
    index = tabela_df.columns[coluna+1]
    
    def full_word(x):
        if x == '-' or x == '-%':    
            x = str(x.replace("-","NaN"))
        return x
    
    tabela_df[index] = tabela_df[index].apply(lambda x: (full_word(x)))
    tabela_df[index] = tabela_df[index].apply(lambda x: (x.replace("%","")))
    tabela_df[index] = tabela_df[index].apply(lambda x: (x.replace("R$","")))
    try:
        tabela_df[index] = tabela_df[index].apply(lambda x: float(x.replace(".","").replace(",",".")))    
    except:
        print('Something wrong!')

#Tratando os NaN
tabela_df = tabela_df.fillna(0)

#plots
for coluna in range(len(tabela_df.columns)-1):
    index = tabela_df.columns[coluna+1]
    
    fig, ax = plt.subplots()
    sns.barplot(x='Ativo', y=tabela_df[index], data=tabela_df)
    plt.ylim(-10, 50)
    print(coluna)







# -*- coding: utf-8 -*- Created on Sun May  9 19:18:01 2021  @author: <NAME> ============================= Visualização de indicadores fundamentalistas. #Tratando os valores para floats #Tratando os NaN #plots