I need to remove the dfA index because when I print dfA i have:
Este Mes Subastas
0 01/01/2018 39
And I need:
Este Mes Subastas
01/01/2018 39
How can I do that? Because I know if I read the csv file and I write index=False but the problem is I convert my original csv and in the first time I need the index to operate and have dfA. I can´t give a name to index and del the column after because this is a restriction
I will use again the dfA to paste it in a xls but without the index
import pandas as pd
df = pd.read_csv('este_mes.csv', sep=',')
df1 = df.groupby(['Fecha'])['Subastas'].sum()
df2 = df1.to_frame().reset_index()
dfA = df2
dfA.columns = ['Este Mes', 'Subastas']
df2 = df2.Subastas
df2.to_csv('este_mes_subastas2.csv', index=False)
SOLUTION:
I can do it without remove the index because I need to paste the dfA on a xlsx so when I did it I set index=Falseand I had the results I was looking for!
import pandas as pd
df = pd.read_csv('este_mes.csv', sep=',')
df1 = df.groupby(['Fecha'])['Subastas'].sum()
df2 = df1.to_frame().reset_index()
dfA = df2
dfA.columns = ['Este Mes', 'Subastas']
df2 = df2.Subastas
df2.to_csv('este_mes_subastas2.csv', index=False)
writer = pd.ExcelWriter('test.xlsx', engine='xlsxwriter')
dfA.to_excel(writer, sheet_name='Este Mes x Dia',index=False)