本文整理汇总了Python中taxcalc.IncomeTaxIO.csv_dump方法的典型用法代码示例。如果您正苦于以下问题:Python IncomeTaxIO.csv_dump方法的具体用法?Python IncomeTaxIO.csv_dump怎么用?Python IncomeTaxIO.csv_dump使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类taxcalc.IncomeTaxIO
的用法示例。
在下文中一共展示了IncomeTaxIO.csv_dump方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_6
# 需要导入模块: from taxcalc import IncomeTaxIO [as 别名]
# 或者: from taxcalc.IncomeTaxIO import csv_dump [as 别名]
def test_6(rawinputfile): # pylint: disable=redefined-outer-name
"""
Test IncomeTaxIO calculate method with no output writing and no blowup and
no reform, using the csv_dump option.
"""
taxyear = 2021
inctax = IncomeTaxIO(input_data=rawinputfile.name,
tax_year=taxyear,
policy_reform=None,
blowup_input_data=False,
output_records=False,
csv_dump=True)
inctax.csv_dump(writing_output_file=False)
assert inctax.tax_year() == taxyear
示例2: main
# 需要导入模块: from taxcalc import IncomeTaxIO [as 别名]
# 或者: from taxcalc.IncomeTaxIO import csv_dump [as 别名]
#.........这里部分代码省略.........
action="store_true")
parser.add_argument('--reform',
help=('REFORM is name of optional file that contains '
'tax reform provisions; the provisions are '
'specified using JSON that may include '
'//-comments. No REFORM filename implies use '
'of current-law policy.'),
default=None)
parser.add_argument('--exact',
help=('optional flag to suppress smoothing in income '
'tax calculations that eliminate marginal-tax-'
'rate-complicating "stair-steps". The default '
'is to smooth, and therefore, not to do the '
' exact calculations called for in the tax '
'law.'),
default=False,
action="store_true")
parser.add_argument('--blowup',
help=('optional flag that triggers the default '
'imputation and blowup (or aging) logic built '
'into the Tax-Calculator that will age the '
'INPUT data from Records.PUF_YEAR to TAXYEAR. '
'No --blowup option implies INPUT data are '
'considered raw data that are not aged or '
'adjusted in any way.'),
default=False,
action="store_true")
parser.add_argument('--weights',
help=('optional flag that causes OUTPUT to have an '
'additional variable [29] containing the s006 '
'sample weight, which will be aged if the '
'--blowup option is used'),
default=False,
action="store_true")
output = parser.add_mutually_exclusive_group(required=False)
output.add_argument('--records',
help=('optional flag that causes the output file to '
'be a CSV-formatted file containing for each '
'INPUT filing unit the TAXYEAR values of each '
'variable in the Records.VALID_READ_VARS set. '
'If the --records option is specified, the '
'output file name will be the same as if the '
'option was not specified, except that the '
'".out-inctax" part is replaced by ".records"'),
default=False,
action="store_true")
output.add_argument('--csvdump',
help=('optional flag that causes the output file to '
'be a CSV-formatted file containing for each '
'INPUT filing unit the TAXYEAR values of each '
'variable in the Records.VALID_READ_VARS set '
'and in the Records.CALCULATED_VARS set. '
'If the --csvdump option is specified, the '
'output file name will be the same as if the '
'option was not specified, except that the '
'".out-inctax" part is replaced by ".csvdump"'),
default=False,
action="store_true")
parser.add_argument('INPUT', nargs='?', default='',
help=('INPUT is name of required CSV file that '
'contains a subset of variables included in '
'the Records.VALID_READ_VARS set. '
'INPUT must end in ".csv".'))
parser.add_argument('TAXYEAR', nargs='?', default=0,
help=('TAXYEAR is calendar year for which federal '
'income taxes are computed (e.g., 2013).'),
type=int)
args = parser.parse_args()
# optionally show INPUT and OUTPUT variable definitions and exit
if args.iohelp:
IncomeTaxIO.show_iovar_definitions()
return 0
# check INPUT filename
if args.INPUT == '':
sys.stderr.write('ERROR: must specify INPUT file name;\n')
sys.stderr.write('USAGE: python inctax.py --help\n')
return 1
# check TAXYEAR value
if args.TAXYEAR == 0:
sys.stderr.write('ERROR: must specify TAXYEAR >= 2013;\n')
sys.stderr.write('USAGE: python inctax.py --help\n')
return 1
# instantiate IncometaxIO object and do federal income tax calculations
inctax = IncomeTaxIO(input_data=args.INPUT,
tax_year=args.TAXYEAR,
policy_reform=args.reform,
exact_calculations=args.exact,
blowup_input_data=args.blowup,
output_weights=args.weights,
output_records=args.records,
csv_dump=args.csvdump)
if args.records:
inctax.output_records(writing_output_file=True)
elif args.csvdump:
inctax.csv_dump(writing_output_file=True)
else:
inctax.calculate(writing_output_file=True,
output_weights=args.weights)
# return no-error exit code
return 0