Home > Net >  How can I Read a input file with pandas/python?
How can I Read a input file with pandas/python?

Time:11-21

I want to create a input that can bea readable by pandas and do some count with sorted values. The problem is that I want that in the input you put the name of the file to do the action but i have some problem. Hope someone can help me. The file is an excel!

Here I give you the code:

import pandas as pd

doc = input('Ingresa el nombre del archivo: ')
print(f'Ingresaste {doc}')

df=pd.read.excel(doc)
df['Recordinaciones'] = df.apply(lambda _: '', axis=1)

rcs=df[['Cliente','# Externo','Recordinaciones']].groupby(['Cliente','# Externo']).count().reset_index().sort_values(['Recordinaciones'],ascending=False)
rcs

enter image description here

CodePudding user response:

You have to put an underscore and not a dot in pandas.read_excel :

Replace this :

df=pd.read.excel(doc)

By this :

df=pd.read_excel(doc)
  • Related