Tag: spyder

模块'xlwings'没有属性'Book'

我正在尝试第一次使用xlwings,但我不能理解文档。 从“快速入门”部分我读了 import xlwings as xw wb = xw.Book() # this will create a new workbook 当我尝试这个“在家”,我没有问题导入xlwings,但与第二个脚本我得到这个错误: AttributeError: module 'xlwings' has no attribute 'Book' 当我尝试查看xw的属性时,我可以看到AboveBelow,ActionTime等,但不是Book。 你能帮忙吗? 非常感谢你。

导入excel文件错误pythonpandas

我无法使用ExcelFile()将Excel文件加载到数据框中。 我input了pandas,xlrd和openpyxl。 我正在使用spyder进行交互式数据分析。 我是pandas和python的新手,所以我会教一个初学者可以理解的答案。 有人可以帮我吗? >>> import xlrd >>> import openpyxl >>> from pandas import * >>> xls = ExcelFile('C:\RWFC\test.xls') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python27\lib\site-packages\pandas\io\parsers.py", line 1294, in __init__ self.book = xlrd.open_workbook(path_or_buf) File "C:\Python27\lib\site-packages\xlrd\__init__.py", line 400, in open_workbook f = open(filename, "rb") IOError: [Errno 22] invalid mode […]

Python中的win32com Spyder控制台导致错误

我直接从这个文档/教程运行下面的代码。 import win32com.client as win32 excel = win32.gencache.EnsureDispatch('Excel.Application') wb = excel.Workbooks.Add() wb.SaveAs('add_a_workbook.xlsx') excel.Application.Quit() 得到这个: execfile(filename, namespace) File "C:/Users/Username/Desktop/script.py", line 106, in <module> wb = excel.Workbooks.Add() File "C:\Users\Username\AppData\Local\Temp\gen_py\2.7\00020813-0000-0000-C000-000000000046x0x1x7\Workbooks.py", line 34, in Add ret = self._oleobj_.InvokeTypes(181, LCID, 1, (13, 0), ((12, 17),),Template TypeError: an integer is required 有没有人有任何想法,为什么? 我试过使用xlsx和xls文件,并更改文件地址,并尝试从该教程中的多个示例,他们都给我类似的错误,我不知道为什么。 我可以得到尽可能wb = excel.Workbooks.Add()之前,我得到了TypeError: an integer is required警告,如果我尝试wb = […]