本文整理匯總了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