本文整理汇总了Python中vis.workflow.WorkflowManager.export方法的典型用法代码示例。如果您正苦于以下问题:Python WorkflowManager.export方法的具体用法?Python WorkflowManager.export怎么用?Python WorkflowManager.export使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vis.workflow.WorkflowManager
的用法示例。
在下文中一共展示了WorkflowManager.export方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_export_4
# 需要导入模块: from vis.workflow import WorkflowManager [as 别名]
# 或者: from vis.workflow.WorkflowManager import export [as 别名]
def test_export_4(self, mock_gdf):
# --> test_export_3() with a valid extension already on
test_wm = WorkflowManager([])
test_wm._result = mock.MagicMock(spec=pandas.DataFrame)
test_wm.export(u'CSV', u'test_path.csv')
test_wm.export(u'Excel', u'test_path.xlsx')
test_wm.export(u'Stata', u'test_path.dta')
test_wm.export(u'HTML', u'test_path.html')
test_wm._result.to_csv.assert_called_once_with(u'test_path.csv')
test_wm._result.to_stata.assert_called_once_with(u'test_path.dta')
test_wm._result.to_excel.assert_called_once_with(u'test_path.xlsx')
test_wm._result.to_html.assert_called_once_with(u'test_path.html')
self.assertEqual(0, mock_gdf.call_count)
示例2: test_export_3
# 需要导入模块: from vis.workflow import WorkflowManager [as 别名]
# 或者: from vis.workflow.WorkflowManager import export [as 别名]
def test_export_3(self, mock_gdf):
# --> the method works as expected for CSV, Excel, and Stata when _result is a DataFrame
test_wm = WorkflowManager([])
test_wm._result = mock.MagicMock(spec=pandas.DataFrame)
test_wm.export(u'CSV', u'test_path')
test_wm.export(u'Excel', u'test_path')
test_wm.export(u'Stata', u'test_path')
test_wm.export(u'HTML', u'test_path')
test_wm._result.to_csv.assert_called_once_with(u'test_path.csv')
test_wm._result.to_stata.assert_called_once_with(u'test_path.dta')
test_wm._result.to_excel.assert_called_once_with(u'test_path.xlsx')
test_wm._result.to_html.assert_called_once_with(u'test_path.html')
self.assertEqual(0, mock_gdf.call_count)
示例3: test_export_5
# 需要导入模块: from vis.workflow import WorkflowManager [as 别名]
# 或者: from vis.workflow.WorkflowManager import export [as 别名]
def test_export_5(self, mock_gdf):
# --> test_export_3() with a Series that requires calling _get_dataframe()
test_wm = WorkflowManager([])
test_wm._result = mock.MagicMock(spec=pandas.Series)
# CSV
mock_gdf.return_value = MagicMock(spec=pandas.DataFrame)
test_wm.export(u'CSV', u'test_path')
mock_gdf.assert_called_once_with(u'data', None, None)
mock_gdf.return_value.to_csv.assert_called_once_with(u'test_path.csv')
mock_gdf.reset_mock()
# Excel
test_wm.export(u'Excel', u'test_path', 5)
mock_gdf.assert_called_once_with(u'data', 5, None)
mock_gdf.return_value.to_excel.assert_called_once_with(u'test_path.xlsx')
mock_gdf.reset_mock()
# Stata
test_wm.export(u'Stata', u'test_path', 5, 10)
mock_gdf.assert_called_once_with(u'data', 5, 10)
mock_gdf.return_value.to_stata.assert_called_once_with(u'test_path.dta')
mock_gdf.reset_mock()
# HTML
test_wm.export(u'HTML', u'test_path', threshold=10)
mock_gdf.assert_called_once_with(u'data', None, 10)
mock_gdf.return_value.to_html.assert_called_once_with(u'test_path.html')