本文整理汇总了Python中pandas.io.common.CParserError方法的典型用法代码示例。如果您正苦于以下问题:Python common.CParserError方法的具体用法?Python common.CParserError怎么用?Python common.CParserError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pandas.io.common
的用法示例。
在下文中一共展示了common.CParserError方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_error_rename
# 需要导入模块: from pandas.io import common [as 别名]
# 或者: from pandas.io.common import CParserError [as 别名]
def test_error_rename():
# see gh-12665
from pandas.errors import ParserError
from pandas.io.common import CParserError
try:
raise CParserError()
except ParserError:
pass
try:
raise ParserError()
except CParserError:
pass
with catch_warnings(record=True):
try:
raise ParserError()
except pd.parser.CParserError:
pass
示例2: _load_df
# 需要导入模块: from pandas.io import common [as 别名]
# 或者: from pandas.io.common import CParserError [as 别名]
def _load_df(self):
if self._df is None:
try:
self._df = pd.read_csv(self.filename)
except pd.errors.EmptyDataError:
logger.warning(
'Trace %s is empty and needs to be resampled!' %
self.filename)
os.remove(self.filename)
self.corrupted_flag = True
except CParserError:
logger.warning(
'Trace %s has wrong size!' % self.filename)
self.corrupted_flag = True
os.remove(self.filename)
if len(self.flat_names) == 0 and not self.corrupted_flag:
self.flat_names, self.var_shapes = extract_variables_from_df(
self._df)
self.varnames = list(self.var_shapes.keys())
示例3: test_error_rename
# 需要导入模块: from pandas.io import common [as 别名]
# 或者: from pandas.io.common import CParserError [as 别名]
def test_error_rename():
# see gh-12665
from pandas.errors import ParserError
from pandas.io.common import CParserError
try:
raise CParserError()
except ParserError:
pass
try:
raise ParserError()
except CParserError:
pass