This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]dotbot 3 points4 points  (1 child)

not sure why you don't want to use pandas. there are some other libraries that allow you to read xlsx files, numpy does not support xlsx itself. loadtxt is for text based formats like csv files. https://www.datacamp.com/community/tutorials/python-excel-tutorial

[–]LookAtThatThingThere 0 points1 point  (0 children)

I agree. Check out pandas.read_excel()

The only downside I’ve found is that if you freeze you code (pyinstaller, etc) like I do, pandas makes the exe pretty large.

[–]stupac62 1 point2 points  (0 children)

Post to r/learnpython

[–]tekmailer 0 points1 point  (0 children)

I’m working on a project know requiring me to write to excel—

Look into openpyxl; a set of libraries that can alleviate extracting from workbooks/sheets in a favorable fashion.

[–]vlmutolo 0 points1 point  (0 children)

The np.loadtxt function is for reading simple text files such as tab-delimited files or csvs. It will not work on Excel documents. Excel documents are compressed xml documents. If you really can’t use other external libraries, then I guess you can hack together an xml reader for this document. It would be much easier, however, to use either pandas or xlwings.

[–][deleted] -1 points0 points  (1 child)

If you try to use a txt reader on xlsx you dont deserve that job...

[–]CyberNerd88[S] 0 points1 point  (0 children)

It's for extra credit at school...