本文整理汇总了Python中pandas.util.py3compat.StringIO.write方法的典型用法代码示例。如果您正苦于以下问题:Python StringIO.write方法的具体用法?Python StringIO.write怎么用?Python StringIO.write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pandas.util.py3compat.StringIO
的用法示例。
在下文中一共展示了StringIO.write方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _coef_table
# 需要导入模块: from pandas.util.py3compat import StringIO [as 别名]
# 或者: from pandas.util.py3compat.StringIO import write [as 别名]
def _coef_table(self):
buffer = StringIO()
buffer.write('%13s %13s %13s %13s %13s %13s\n' %
('Variable', 'Beta', 'Std Err', 't-stat', 'CI 2.5%', 'CI 97.5%'))
template = '%13s %13.4f %13.4f %13.2f %13.4f %13.4f\n'
for i, name in enumerate(self._cols):
if i and not (i % 5):
buffer.write('\n' + common.banner(''))
mean_beta = self._results['mean_beta'][i]
std_beta = self._results['std_beta'][i]
t_stat = self._results['t_stat'][i]
ci1 = mean_beta - 1.96 * std_beta
ci2 = mean_beta + 1.96 * std_beta
values = '(%s)' % name, mean_beta, std_beta, t_stat, ci1, ci2
buffer.write(template % values)
if self._nw_lags_beta is not None:
buffer.write('\n')
buffer.write('*** The Std Err, t-stat are Newey-West '
'adjusted with Lags %5d\n' % self._nw_lags_beta)
return buffer.getvalue()
示例2: generate_from_template
# 需要导入模块: from pandas.util.py3compat import StringIO [as 别名]
# 或者: from pandas.util.py3compat.StringIO import write [as 别名]
def generate_from_template(template, ndim=1, exclude=None):
output = StringIO()
for name, c_type, dtype, can_hold_na in function_list:
if exclude is not None and name in exclude:
continue
func = template % {'name': name, 'c_type': c_type,
'dtype': dtype,
'raise_on_na': 'False' if can_hold_na else 'True'}
output.write(func)
return output.getvalue()
示例3: generate_put_functions
# 需要导入模块: from pandas.util.py3compat import StringIO [as 别名]
# 或者: from pandas.util.py3compat.StringIO import write [as 别名]
def generate_put_functions():
function_list = [
('float64', 'float64_t', 'object'),
('float64', 'float64_t', 'float64_t'),
('object', 'object', 'object'),
('int32', 'int32_t', 'int64_t'),
('int32', 'int32_t', 'float64_t'),
('int32', 'int32_t', 'object'),
('int64', 'int64_t', 'int64_t'),
('int64', 'int64_t', 'float64_t'),
('int64', 'int64_t', 'object'),
('bool', 'uint8_t', 'uint8_t'),
('bool', 'uint8_t', 'object')
]
output = StringIO()
for name, c_type, dest_type in function_list:
func = put2d_template % {'name' : name, 'c_type' : c_type,
'dest_type' : dest_type.replace('_t', ''),
'dest_type2' : dest_type}
output.write(func)
return output.getvalue()
示例4: generate_ensure_dtypes
# 需要导入模块: from pandas.util.py3compat import StringIO [as 别名]
# 或者: from pandas.util.py3compat.StringIO import write [as 别名]
def generate_ensure_dtypes():
output = StringIO()
for name, ctype, dtype in ensure_functions:
filled = ensure_dtype_template % locals()
output.write(filled)
return output.getvalue()