本文整理汇总了Python中Orange.data.table.Table.from_url方法的典型用法代码示例。如果您正苦于以下问题:Python Table.from_url方法的具体用法?Python Table.from_url怎么用?Python Table.from_url使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Orange.data.table.Table
的用法示例。
在下文中一共展示了Table.from_url方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load_url
# 需要导入模块: from Orange.data.table import Table [as 别名]
# 或者: from Orange.data.table.Table import from_url [as 别名]
def load_url(self, from_reload=False):
url = self.combo.currentText()
if not url:
return
prev_table = self.table
try:
with self.progressBar(3) as progress:
progress.advance()
table = Table.from_url(url)
progress.advance()
except Exception as e:
log.exception("Couldn't load data from: %s", url)
self.Error.error(try_(lambda: e.args[0], ''))
self.table = None
else:
self.Error.clear()
self.table = table
self.combo.setTitleFor(self.combo.currentIndex(), table.name)
self.set_info()
def _equal(data1, data2):
NAN = float('nan')
return (try_(lambda: data1.checksum(), NAN) ==
try_(lambda: data2.checksum(), NAN))
if not (from_reload and _equal(prev_table, self.table)):
self.commit()
示例2: retrieve
# 需要导入模块: from Orange.data.table import Table [as 别名]
# 或者: from Orange.data.table.Table import from_url [as 别名]
def retrieve(self, url):
if not url: return
progress = gui.ProgressBar(self, 10)
for i in range(3): progress.advance()
try: table = Table.from_url(url)
except Exception as e:
import traceback
log.error(traceback.format_exc())
log.error("Couldn't load spreadsheet %s: %s", url, e)
self.error("Couldn't load spreadsheet. Ensure correct read permissions; rectangular, top-left aligned sheet data ...")
return
else:
for i in range(7): progress.advance()
finally:
progress.finish()
return table