0

I'm trying to read an excel file using pandas in a views method.

But the server stopped with:

File "/Users/ronsair/anaconda3/lib/python3.6/site-packages/py/_error.py", line 44, in __getattr__
    raise AttributeError(name)    
AttributeError: __name__

Code:

import pandas as pd

def extract(request):
  df = pd.read_excel('update.xlsx')
  return render(request, "work/index.html")

Can you help please?

3
  • Can you share the full stack trace? Also can you make sure the excel file is within reach of the server (check your relative path)? Commented Nov 2, 2019 at 10:45
  • print(os.path.exists('update.xlsx')) returns True Commented Nov 2, 2019 at 12:52
  • Here is the trace: github.com/ronscoder/Store/blob/master/error_pandas_django Commented Nov 2, 2019 at 12:53

1 Answer 1

1

This was fixed after updating Pandas package from 0.22.0 to 0.25.3.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.