In Python 3 and pandas I have this dataframe:
import pandas as pd
ano_2016_exec = pd.read_excel('emendas/emendas_executadas_autores_2016.xls',sheet_name='Sheet1', decimal = ",")
ano_2016_exec.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 10428 entries, 0 to 10427
Data columns (total 9 columns):
Autor 10427 non-null object
Emenda 10427 non-null object
UO_Ajustada 10427 non-null object
Funcional 10427 non-null object
Acao_e_Subtitulo 10427 non-null object
Valor_aprovado 10428 non-null float64
Empenhado 10428 non-null float64
Depesa_Executada 10428 non-null float64
Pago 10428 non-null float64
dtypes: float64(4), object(5)
memory usage: 733.3+ KB
In the original file, the columns "Valor_aprovado", "Empenhado", "Despesa_Executada" and "Pago" are numbers with a decimal point -> ",". Example:
3647087716,31449 -> represents in decimal "." 3,647,087,716.31449
498820,7 -> 498,820.7
But the loaded file transformed these columns into float, with notation:
colunas_selecionadas = ["Valor_aprovado", "Empenhado", "Depesa_Executada", "Pago"] ano_2016_exec[colunas_selecionadas].head()
Valor_aprovado Empenhado Depesa_Executada Pago
0 9.100292e+09 7.268573e+09 7.268573e+09 3.647088e+09
1 6.471218e+06 6.471218e+06 6.471218e+06 0.000000e+00
2 1.200000e+06 3.421430e+05 3.421430e+05 1.710710e+05
3 7.471218e+06 6.713361e+06 6.713361e+06 0.000000e+00
4 2.000000e+05 1.000000e+05 1.000000e+05 1.000000e+05
Like:
7.268573e+09
3.647088e+09
6.471218e+06
I want these numbers to appear in my dataframe with two decimals and not in notation. Like this:
7,268,572,739.83
3,647,087,716.31
Please, is this possible?
How should I properly load the data file 'emendas_executadas_autores_2016.xls'?