本文整理汇总了Python中pyvttbl.DataFrame.write方法的典型用法代码示例。如果您正苦于以下问题:Python DataFrame.write方法的具体用法?Python DataFrame.write怎么用?Python DataFrame.write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyvttbl.DataFrame
的用法示例。
在下文中一共展示了DataFrame.write方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Test_writeTable
# 需要导入模块: from pyvttbl import DataFrame [as 别名]
# 或者: from pyvttbl.DataFrame import write [as 别名]
class Test_writeTable(unittest.TestCase):
def setUp(self):
self.df=DataFrame()
self.df.read_tbl('data/suppression~subjectXgroupXageXcycleXphase.csv')
def test0(self):
d='data/suppression~subjectXgroupXageXcycleXphase.csv'
r='subjectXsexXageXgroupXcycleXphaseXsuppressionXranddata.csv'
self.df.write()
self.assertTrue(fcmp(d,r))
# clean up
os.remove('./subjectXsexXageXgroupXcycleXphaseXsuppressionXranddata.csv')
def test1(self):
# with exclusion
d='data/suppression~subjectXgroupXageXcycleXphase.csv'
r='subjectXsexXageXgroupXcycleXphaseXsuppressionXranddata.csv'
self.df.write(where=[('AGE','not in',['young'])])
self.assertTrue(fcmp(d,r))
# clean up
os.remove('./subjectXsexXageXgroupXcycleXphaseXsuppressionXranddata.csv')
示例2: OrderedDict
# 需要导入模块: from pyvttbl import DataFrame [as 别名]
# 或者: from pyvttbl.DataFrame import write [as 别名]
# figure out pid and independent variable conditions
pid = daq.etc['pid']
trial = epoch / 10
scenario = daq.etc['scen_order'][trial]
section = epoch % 10
# pack pid and IV conditions into OrderedDict
row = OrderedDict([('pid', pid),
('trial', trial),
('scenario', scenario),
('section', section)])
for (dv, indx) in dvs:
vec = daq[dv][indx,fslice].flatten()
row['%s_mean'%dv] = np.mean(vec)
row['%s_min'%dv] = np.min(vec)
row['%s_max'%dv] = np.max(vec)
row['%s_range'%dv] = row['%s_max'%dv] - row['%s_min'%dv]
row['%s_amean'%dv] = np.mean(np.abs(vec))
row['%s_sd'%dv] = np.std(vec)
row['%s_rms'%dv] = np.linalg.norm(vec)/np.sqrt(len(vec))
# insert the row into the dataframe
df.insert(row)
df.write(fname='collaborated_ts.csv')
print('\nDone.\n\ncollaborating timeseries measureas took %.1f s'%(time.time()-t0))