<s> from datetime import datetime , date <EOL> import sys <EOL> if sys . version_info >= ( <NUM_LIT:2> , <NUM_LIT:7> ) : <EOL> from nose . tools import assert_dict_equal <EOL> import xlwings as xw <EOL> try : <EOL> import numpy as np <EOL> from numpy . testing import assert_array_equal <EOL> def nparray_equal ( a , b ) : <EOL> try : <EOL> assert_array_equal ( a , b ) <EOL> except AssertionError : <EOL> return False <EOL> return True <EOL> except ImportError : <EOL> np = None <EOL> try : <EOL> import pandas as pd <EOL> from pandas import DataFrame , Series <EOL> from pandas . util . testing import assert_frame_equal , assert_series_equal <EOL> def frame_equal ( a , b ) : <EOL> try : <EOL> assert_frame_equal ( a , b ) <EOL> except AssertionError : <EOL> return False <EOL> return True <EOL> def series_equal ( a , b ) : <EOL> try : <EOL> assert_series_equal ( a , b ) <EOL> except AssertionError : <EOL> return False <EOL> return True <EOL> except ImportError : <EOL> pd = None <EOL> def dict_equal ( a , b ) : <EOL> try : <EOL> assert_dict_equal ( a , b ) <EOL> except AssertionError : <EOL> return False <EOL> return True <EOL> @ xw . func <EOL> def read_float ( x ) : <EOL> return x == <NUM_LIT> <EOL> @ xw . func <EOL> def write_float ( ) : <EOL> return <NUM_LIT> <EOL> @ xw . func <EOL> def read_string ( x ) : <EOL> return x == '<STR_LIT>' <EOL> @ xw . func <EOL> def write_string ( ) : <EOL> return '<STR_LIT>' <EOL> @ xw . func <EOL> def read_empty ( x ) : <EOL> return x is None <EOL> @ xw . func <EOL> def read_date ( x ) : <EOL> return x == datetime ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:15> ) <EOL> @ xw . func <EOL> def write_date ( ) : <EOL> return datetime ( <NUM_LIT> , <NUM_LIT:12> , <NUM_LIT> ) <EOL> @ xw . func <EOL> def read_datetime ( x ) : <EOL> return x == datetime ( <NUM_LIT> , <NUM_LIT:2> , <NUM_LIT:15> , <NUM_LIT> , <NUM_LIT:6> , <NUM_LIT> ) <EOL> @ xw . func <EOL> def write_datetime ( ) : <EOL> return datetime ( <NUM_LIT> , <NUM_LIT:2> , <NUM_LIT:15> , <NUM_LIT> , <NUM_LIT:6> , <NUM_LIT> ) <EOL> @ xw . func <EOL> def read_horizontal_list ( x ) : <EOL> return x == [ <NUM_LIT:1.> , <NUM_LIT> ] <EOL> @ xw . func <EOL> def write_horizontal_list ( ) : <EOL> return [ <NUM_LIT:1.> , <NUM_LIT> ] <EOL> @ xw . func <EOL> def read_vertical_list ( x ) : <EOL> return x == [ <NUM_LIT:1.> , <NUM_LIT> ] <EOL> @ xw . func <EOL> def write_vertical_list ( ) : <EOL> return [ [ <NUM_LIT:1.> ] , [ <NUM_LIT> ] ] <EOL> @ xw . func <EOL> def read_2dlist ( x ) : <EOL> return x == [ [ <NUM_LIT:1.> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> ] ] <EOL> @ xw . func <EOL> def write_2dlist ( ) : <EOL> return [ [ <NUM_LIT:1.> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> ] ] <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , ndim = <NUM_LIT:1> ) <EOL> def read_ndim1 ( x ) : <EOL> return x == [ <NUM_LIT> ] <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , ndim = <NUM_LIT:2> ) <EOL> def read_ndim2 ( x ) : <EOL> return x == [ [ <NUM_LIT> ] ] <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , transpose = True ) <EOL> def read_transpose ( x ) : <EOL> return x == [ [ <NUM_LIT:1.> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> ] ] <EOL> @ xw . func <EOL> @ xw . ret ( transpose = True ) <EOL> def write_transpose ( ) : <EOL> return [ [ <NUM_LIT:1.> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> ] ] <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , dates = date ) <EOL> def read_dates_as1 ( x ) : <EOL> return x == [ [ <NUM_LIT:1.> , date ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT> ) ] , [ date ( <NUM_LIT> , <NUM_LIT:12> , <NUM_LIT:1> ) , <NUM_LIT> ] ] <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , dates = date ) <EOL> def read_dates_as2 ( x ) : <EOL> return x == date ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:15> ) <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , dates = datetime ) <EOL> def read_dates_as3 ( x ) : <EOL> return x == [ [ <NUM_LIT:1.> , datetime ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT> ) ] , [ datetime ( <NUM_LIT> , <NUM_LIT:12> , <NUM_LIT:1> ) , <NUM_LIT> ] ] <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , empty = '<STR_LIT>' ) <EOL> def read_empty_as ( x ) : <EOL> return x == [ [ <NUM_LIT:1.> , '<STR_LIT>' ] , [ '<STR_LIT>' , <NUM_LIT> ] ] <EOL> if sys . version_info >= ( <NUM_LIT:2> , <NUM_LIT:7> ) : <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , dict ) <EOL> def read_dict ( x ) : <EOL> return dict_equal ( x , { '<STR_LIT:a>' : <NUM_LIT:1.> , '<STR_LIT:b>' : '<STR_LIT:c>' } ) <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , dict , transpose = True ) <EOL> def read_dict_transpose ( x ) : <EOL> return dict_equal ( x , { <NUM_LIT:1.0> : '<STR_LIT:c>' , '<STR_LIT:a>' : '<STR_LIT:b>' } ) <EOL> @ xw . func <EOL> def write_dict ( ) : <EOL> return { '<STR_LIT:a>' : <NUM_LIT:1.> , '<STR_LIT:b>' : '<STR_LIT:c>' } <EOL> if np : <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , np . array ) <EOL> def read_scalar_nparray ( x ) : <EOL> return nparray_equal ( x , np . array ( <NUM_LIT:1.> ) ) <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , np . array ) <EOL> def read_empty_nparray ( x ) : <EOL> return nparray_equal ( x , np . array ( np . nan ) ) <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , np . array ) <EOL> def read_horizontal_nparray ( x ) : <EOL> return nparray_equal ( x , np . array ( [ <NUM_LIT:1.> , <NUM_LIT> ] ) ) <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , np . array ) <EOL> def read_vertical_nparray ( x ) : <EOL> return nparray_equal ( x , np . array ( [ <NUM_LIT:1.> , <NUM_LIT> ] ) ) <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , np . array ) <EOL> def read_date_nparray ( x ) : <EOL> return nparray_equal ( x , np . array ( datetime ( <NUM_LIT> , <NUM_LIT:12> , <NUM_LIT:20> ) ) ) <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , np . array , ndim = <NUM_LIT:1> ) <EOL> def read_ndim1_nparray ( x ) : <EOL> return nparray_equal ( x , np . array ( [ <NUM_LIT> ] ) ) <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , np . array , ndim = <NUM_LIT:2> ) <EOL> def read_ndim2_nparray ( x ) : <EOL> return nparray_equal ( x , np . array ( [ [ <NUM_LIT> ] ] ) ) <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , np . array , transpose = True ) <EOL> def read_transpose_nparray ( x ) : <EOL> return nparray_equal ( x , np . array ( [ [ <NUM_LIT:1.> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> ] ] ) ) <EOL> @ xw . func <EOL> @ xw . ret ( transpose = True ) <EOL> def write_transpose_nparray ( ) : <EOL> return np . array ( [ [ <NUM_LIT:1.> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> ] ] ) <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , np . array , dates = date ) <EOL> def read_dates_as_nparray ( x ) : <EOL> return nparray_equal ( x , np . array ( date ( <NUM_LIT> , <NUM_LIT:12> , <NUM_LIT:20> ) ) ) <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , np . array , empty = '<STR_LIT>' ) <EOL> def read_empty_as_nparray ( x ) : <EOL> return nparray_equal ( x , np . array ( '<STR_LIT>' ) ) <EOL> @ xw . func <EOL> def write_np_scalar ( ) : <EOL> return np . float64 ( <NUM_LIT:2> ) <EOL> if pd : <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , pd . Series , header = False , index = False ) <EOL> def read_series_noheader_noindex ( x ) : <EOL> return series_equal ( x , pd . Series ( [ <NUM_LIT:1.> , <NUM_LIT> ] ) ) <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , pd . Series , header = False , index = True ) <EOL> def read_series_noheader_index ( x ) : <EOL> return series_equal ( x , pd . Series ( [ <NUM_LIT:1.> , <NUM_LIT> ] , index = [ <NUM_LIT> , <NUM_LIT> ] ) ) <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , pd . Series , header = True , index = False ) <EOL> def read_series_header_noindex ( x ) : <EOL> return series_equal ( x , pd . Series ( [ <NUM_LIT:1.> , <NUM_LIT> ] , name = '<STR_LIT:name>' ) ) <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , pd . Series , header = True , index = True ) <EOL> def read_series_header_named_index ( x ) : <EOL> return series_equal ( x , pd . Series ( [ <NUM_LIT:1.> , <NUM_LIT> ] , name = '<STR_LIT:name>' , index = pd . Index ( [ <NUM_LIT> , <NUM_LIT> ] , name = '<STR_LIT>' ) ) ) <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , pd . Series , header = True , index = True ) <EOL> def read_series_header_nameless_index ( x ) : <EOL> return series_equal ( x , pd . Series ( [ <NUM_LIT:1.> , <NUM_LIT> ] , name = '<STR_LIT:name>' , index = [ <NUM_LIT> , <NUM_LIT> ] ) ) <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , pd . Series , header = True , index = <NUM_LIT:2> ) <EOL> def read_series_header_nameless_2index ( x ) : <EOL> ix = pd . MultiIndex . from_arrays ( [ [ '<STR_LIT:a>' , '<STR_LIT:a>' ] , [ <NUM_LIT> , <NUM_LIT> ] ] ) <EOL> return series_equal ( x , pd . Series ( [ <NUM_LIT:1.> , <NUM_LIT> ] , name = '<STR_LIT:name>' , index = ix ) ) <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , pd . Series , header = True , index = <NUM_LIT:2> ) <EOL> def read_series_header_named_2index ( x ) : <EOL> ix = pd . MultiIndex . from_arrays ( [ [ '<STR_LIT:a>' , '<STR_LIT:a>' ] , [ <NUM_LIT> , <NUM_LIT> ] ] , names = [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> return series_equal ( x , pd . Series ( [ <NUM_LIT:1.> , <NUM_LIT> ] , name = '<STR_LIT:name>' , index = ix ) ) <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , pd . Series , header = False , index = <NUM_LIT:2> ) <EOL> def read_series_noheader_2index ( x ) : <EOL> ix = pd . MultiIndex . from_arrays ( [ [ '<STR_LIT:a>' , '<STR_LIT:a>' ] , [ <NUM_LIT> , <NUM_LIT> ] ] ) <EOL> return series_equal ( x , pd . Series ( [ <NUM_LIT:1.> , <NUM_LIT> ] , index = ix ) ) <EOL> @ xw . func <EOL> @ xw . ret ( pd . Series , index = False ) <EOL> def write_series_noheader_noindex ( ) : <EOL> return pd . Series ( [ <NUM_LIT:1.> , <NUM_LIT> ] ) <EOL> @ xw . func <EOL> @ xw . ret ( pd . Series , index = True ) <EOL> def write_series_noheader_index ( ) : <EOL> return pd . Series ( [ <NUM_LIT:1.> , <NUM_LIT> ] , index = [ <NUM_LIT> , <NUM_LIT> ] ) <EOL> @ xw . func <EOL> @ xw . ret ( pd . Series , index = False ) <EOL> def write_series_header_noindex ( ) : <EOL> return pd . Series ( [ <NUM_LIT:1.> , <NUM_LIT> ] , name = '<STR_LIT:name>' ) <EOL> @ xw . func <EOL> def write_series_header_named_index ( ) : <EOL> return pd . Series ( [ <NUM_LIT:1.> , <NUM_LIT> ] , name = '<STR_LIT:name>' , index = pd . Index ( [ <NUM_LIT> , <NUM_LIT> ] , name = '<STR_LIT>' ) ) <EOL> @ xw . func <EOL> @ xw . ret ( pd . Series , index = True , header = True ) <EOL> def write_series_header_nameless_index ( ) : <EOL> return pd . Series ( [ <NUM_LIT:1.> , <NUM_LIT> ] , name = '<STR_LIT:name>' , index = [ <NUM_LIT> , <NUM_LIT> ] ) <EOL> @ xw . func <EOL> @ xw . ret ( pd . Series , header = True , index = <NUM_LIT:2> ) <EOL> def write_series_header_nameless_2index ( ) : <EOL> ix = pd . MultiIndex . from_arrays ( [ [ '<STR_LIT:a>' , '<STR_LIT:a>' ] , [ <NUM_LIT> , <NUM_LIT> ] ] ) <EOL> return pd . Series ( [ <NUM_LIT:1.> , <NUM_LIT> ] , name = '<STR_LIT:name>' , index = ix ) <EOL> @ xw . func <EOL> @ xw . ret ( pd . Series , header = True , index = <NUM_LIT:2> ) <EOL> def write_series_header_named_2index ( ) : <EOL> ix = pd . MultiIndex . from_arrays ( [ [ '<STR_LIT:a>' , '<STR_LIT:a>' ] , [ <NUM_LIT> , <NUM_LIT> ] ] , names = [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> return pd . Series ( [ <NUM_LIT:1.> , <NUM_LIT> ] , name = '<STR_LIT:name>' , index = ix ) <EOL> @ xw . func <EOL> @ xw . ret ( pd . Series , header = False , index = <NUM_LIT:2> ) <EOL> def write_series_noheader_2index ( ) : <EOL> ix = pd . MultiIndex . from_arrays ( [ [ '<STR_LIT:a>' , '<STR_LIT:a>' ] , [ <NUM_LIT> , <NUM_LIT> ] ] ) <EOL> return pd . Series ( [ <NUM_LIT:1.> , <NUM_LIT> ] , index = ix ) <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , pd . Series ) <EOL> def read_timeseries ( x ) : <EOL> return series_equal ( x , pd . Series ( [ <NUM_LIT> , <NUM_LIT> ] , name = '<STR_LIT>' , index = [ datetime ( <NUM_LIT> , <NUM_LIT:12> , <NUM_LIT:20> ) , datetime ( <NUM_LIT> , <NUM_LIT:12> , <NUM_LIT> ) ] ) ) <EOL> @ xw . func <EOL> @ xw . ret ( pd . Series ) <EOL> def write_timeseries ( ) : <EOL> return pd . Series ( [ <NUM_LIT> , <NUM_LIT> ] , name = '<STR_LIT>' , index = [ datetime ( <NUM_LIT> , <NUM_LIT:12> , <NUM_LIT:20> ) , datetime ( <NUM_LIT> , <NUM_LIT:12> , <NUM_LIT> ) ] ) <EOL> if pd : <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , pd . DataFrame , index = False , header = False ) <EOL> def read_df_0header_0index ( x ) : <EOL> return frame_equal ( x , pd . DataFrame ( [ [ <NUM_LIT:1.> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> ] ] ) ) <EOL> @ xw . func <EOL> @ xw . ret ( pd . DataFrame , index = False , header = False ) <EOL> def write_df_0header_0index ( ) : <EOL> return pd . DataFrame ( [ [ <NUM_LIT:1.> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> ] ] ) <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , pd . DataFrame , index = False , header = True ) <EOL> def read_df_1header_0index ( x ) : <EOL> return frame_equal ( x , pd . DataFrame ( [ [ <NUM_LIT:1.> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> ] ] , columns = [ '<STR_LIT:a>' , '<STR_LIT:b>' ] ) ) <EOL> @ xw . func <EOL> @ xw . ret ( pd . DataFrame , index = False , header = True ) <EOL> def write_df_1header_0index ( ) : <EOL> return pd . DataFrame ( [ [ <NUM_LIT:1.> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> ] ] , columns = [ '<STR_LIT:a>' , '<STR_LIT:b>' ] ) <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , pd . DataFrame , index = True , header = False ) <EOL> def read_df_0header_1index ( x ) : <EOL> return frame_equal ( x , pd . DataFrame ( [ [ <NUM_LIT:1.> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> ] ] , index = [ <NUM_LIT> , <NUM_LIT> ] ) ) <EOL> @ xw . func <EOL> @ xw . ret ( pd . DataFrame , index = True , header = False ) <EOL> def write_df_0header_1index ( ) : <EOL> return pd . DataFrame ( [ [ <NUM_LIT:1.> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> ] ] , index = [ <NUM_LIT:10> , <NUM_LIT:20> ] ) <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , pd . DataFrame , index = <NUM_LIT:2> , header = False ) <EOL> def read_df_0header_2index ( x ) : <EOL> df = pd . DataFrame ( [ [ <NUM_LIT:1.> , <NUM_LIT> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ] , <EOL> index = pd . MultiIndex . from_arrays ( [ [ '<STR_LIT:a>' , '<STR_LIT:a>' , '<STR_LIT:b>' ] , [ <NUM_LIT:1.> , <NUM_LIT> , <NUM_LIT:1.> ] ] ) ) <EOL> return frame_equal ( x , df ) <EOL> @ xw . func <EOL> @ xw . ret ( pd . DataFrame , index = <NUM_LIT:2> , header = False ) <EOL> def write_df_0header_2index ( ) : <EOL> df = pd . DataFrame ( [ [ <NUM_LIT:1.> , <NUM_LIT> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ] , <EOL> index = pd . MultiIndex . from_arrays ( [ [ '<STR_LIT:a>' , '<STR_LIT:a>' , '<STR_LIT:b>' ] , [ <NUM_LIT:1.> , <NUM_LIT> , <NUM_LIT:1.> ] ] ) ) <EOL> return df <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , pd . DataFrame , index = <NUM_LIT:1> , header = <NUM_LIT:1> ) <EOL> def read_df_1header_1namedindex ( x ) : <EOL> df = pd . DataFrame ( [ [ <NUM_LIT:1.> , <NUM_LIT> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ] , <EOL> index = [ <NUM_LIT:1.> , <NUM_LIT> ] , <EOL> columns = [ '<STR_LIT:c>' , '<STR_LIT:d>' , '<STR_LIT:c>' ] ) <EOL> df . index . name = '<STR_LIT>' <EOL> return frame_equal ( x , df ) <EOL> @ xw . func <EOL> def write_df_1header_1namedindex ( ) : <EOL> df = pd . DataFrame ( [ [ <NUM_LIT:1.> , <NUM_LIT> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ] , <EOL> index = [ <NUM_LIT:1.> , <NUM_LIT> ] , <EOL> columns = [ '<STR_LIT:c>' , '<STR_LIT:d>' , '<STR_LIT:c>' ] ) <EOL> df . index . name = '<STR_LIT>' <EOL> return df <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , pd . DataFrame , index = <NUM_LIT:1> , header = <NUM_LIT:1> ) <EOL> def read_df_1header_1unnamedindex ( x ) : <EOL> df = pd . DataFrame ( [ [ <NUM_LIT:1.> , <NUM_LIT> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ] , <EOL> index = [ <NUM_LIT:1.> , <NUM_LIT> ] , <EOL> columns = [ '<STR_LIT:c>' , '<STR_LIT:d>' , '<STR_LIT:c>' ] ) <EOL> return frame_equal ( x , df ) <EOL> @ xw . func <EOL> def write_df_1header_1unnamedindex ( ) : <EOL> df = pd . DataFrame ( [ [ <NUM_LIT:1.> , <NUM_LIT> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ] , <EOL> index = [ <NUM_LIT:1.> , <NUM_LIT> ] , <EOL> columns = [ '<STR_LIT:c>' , '<STR_LIT:d>' , '<STR_LIT:c>' ] ) <EOL> return df <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , pd . DataFrame , index = False , header = <NUM_LIT:2> ) <EOL> def read_df_2header_0index ( x ) : <EOL> df = pd . DataFrame ( [ [ <NUM_LIT:1.> , <NUM_LIT> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ] , <EOL> columns = pd . MultiIndex . from_arrays ( [ [ '<STR_LIT:a>' , '<STR_LIT:a>' , '<STR_LIT:b>' ] , [ '<STR_LIT:c>' , '<STR_LIT:d>' , '<STR_LIT:c>' ] ] ) ) <EOL> return frame_equal ( x , df ) <EOL> @ xw . func <EOL> @ xw . ret ( pd . DataFrame , index = False , header = <NUM_LIT:2> ) <EOL> def write_df_2header_0index ( ) : <EOL> df = pd . DataFrame ( [ [ <NUM_LIT:1.> , <NUM_LIT> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ] , <EOL> columns = pd . MultiIndex . from_arrays ( [ [ '<STR_LIT:a>' , '<STR_LIT:a>' , '<STR_LIT:b>' ] , [ '<STR_LIT:c>' , '<STR_LIT:d>' , '<STR_LIT:c>' ] ] ) ) <EOL> return df <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , pd . DataFrame , index = <NUM_LIT:1> , header = <NUM_LIT:2> ) <EOL> def read_df_2header_1namedindex ( x ) : <EOL> df = pd . DataFrame ( [ [ <NUM_LIT:1.> , <NUM_LIT> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ] , <EOL> index = [ <NUM_LIT:1.> , <NUM_LIT> ] , <EOL> columns = pd . MultiIndex . from_arrays ( [ [ '<STR_LIT:a>' , '<STR_LIT:a>' , '<STR_LIT:b>' ] , [ '<STR_LIT:c>' , '<STR_LIT:d>' , '<STR_LIT:c>' ] ] ) ) <EOL> df . index . name = '<STR_LIT>' <EOL> return frame_equal ( x , df ) <EOL> @ xw . func <EOL> def write_df_2header_1namedindex ( ) : <EOL> df = pd . DataFrame ( [ [ <NUM_LIT:1.> , <NUM_LIT> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ] , <EOL> index = [ <NUM_LIT:1.> , <NUM_LIT> ] , <EOL> columns = pd . MultiIndex . from_arrays ( [ [ '<STR_LIT:a>' , '<STR_LIT:a>' , '<STR_LIT:b>' ] , [ '<STR_LIT:c>' , '<STR_LIT:d>' , '<STR_LIT:c>' ] ] ) ) <EOL> df . index . name = '<STR_LIT>' <EOL> return df <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , pd . DataFrame , index = <NUM_LIT:1> , header = <NUM_LIT:2> ) <EOL> def read_df_2header_1unnamedindex ( x ) : <EOL> df = pd . DataFrame ( [ [ <NUM_LIT:1.> , <NUM_LIT> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ] , <EOL> index = [ <NUM_LIT:1.> , <NUM_LIT> ] , <EOL> columns = pd . MultiIndex . from_arrays ( [ [ '<STR_LIT:a>' , '<STR_LIT:a>' , '<STR_LIT:b>' ] , [ '<STR_LIT:c>' , '<STR_LIT:d>' , '<STR_LIT:c>' ] ] ) ) <EOL> return frame_equal ( x , df ) <EOL> @ xw . func <EOL> def write_df_2header_1unnamedindex ( ) : <EOL> df = pd . DataFrame ( [ [ <NUM_LIT:1.> , <NUM_LIT> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ] , <EOL> index = [ <NUM_LIT:1.> , <NUM_LIT> ] , <EOL> columns = pd . MultiIndex . from_arrays ( [ [ '<STR_LIT:a>' , '<STR_LIT:a>' , '<STR_LIT:b>' ] , [ '<STR_LIT:c>' , '<STR_LIT:d>' , '<STR_LIT:c>' ] ] ) ) <EOL> return df <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , pd . DataFrame , index = <NUM_LIT:2> , header = <NUM_LIT:2> ) <EOL> def read_df_2header_2namedindex ( x ) : <EOL> df = pd . DataFrame ( [ [ <NUM_LIT:1.> , <NUM_LIT> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ] , <EOL> index = pd . MultiIndex . from_arrays ( [ [ '<STR_LIT:a>' , '<STR_LIT:a>' , '<STR_LIT:b>' ] , [ <NUM_LIT:1.> , <NUM_LIT> , <NUM_LIT:1.> ] ] , names = [ '<STR_LIT>' , '<STR_LIT>' ] ) , <EOL> columns = pd . MultiIndex . from_arrays ( [ [ '<STR_LIT:a>' , '<STR_LIT:a>' , '<STR_LIT:b>' ] , [ '<STR_LIT:c>' , '<STR_LIT:d>' , '<STR_LIT:c>' ] ] ) ) <EOL> return frame_equal ( x , df ) <EOL> @ xw . func <EOL> def write_df_2header_2namedindex ( ) : <EOL> df = pd . DataFrame ( [ [ <NUM_LIT:1.> , <NUM_LIT> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ] , <EOL> index = pd . MultiIndex . from_arrays ( [ [ '<STR_LIT:a>' , '<STR_LIT:a>' , '<STR_LIT:b>' ] , [ <NUM_LIT:1.> , <NUM_LIT> , <NUM_LIT:1.> ] ] , names = [ '<STR_LIT>' , '<STR_LIT>' ] ) , <EOL> columns = pd . MultiIndex . from_arrays ( [ [ '<STR_LIT:a>' , '<STR_LIT:a>' , '<STR_LIT:b>' ] , [ '<STR_LIT:c>' , '<STR_LIT:d>' , '<STR_LIT:c>' ] ] ) ) <EOL> return df <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , pd . DataFrame , index = <NUM_LIT:2> , header = <NUM_LIT:2> ) <EOL> def read_df_2header_2unnamedindex ( x ) : <EOL> df = pd . DataFrame ( [ [ <NUM_LIT:1.> , <NUM_LIT> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ] , <EOL> index = pd . MultiIndex . from_arrays ( [ [ '<STR_LIT:a>' , '<STR_LIT:a>' , '<STR_LIT:b>' ] , [ <NUM_LIT:1.> , <NUM_LIT> , <NUM_LIT:1.> ] ] ) , <EOL> columns = pd . MultiIndex . from_arrays ( [ [ '<STR_LIT:a>' , '<STR_LIT:a>' , '<STR_LIT:b>' ] , [ '<STR_LIT:c>' , '<STR_LIT:d>' , '<STR_LIT:c>' ] ] ) ) <EOL> return frame_equal ( x , df ) <EOL> @ xw . func <EOL> def write_df_2header_2unnamedindex ( ) : <EOL> df = pd . DataFrame ( [ [ <NUM_LIT:1.> , <NUM_LIT> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ] , <EOL> index = pd . MultiIndex . from_arrays ( [ [ '<STR_LIT:a>' , '<STR_LIT:a>' , '<STR_LIT:b>' ] , [ <NUM_LIT:1.> , <NUM_LIT> , <NUM_LIT:1.> ] ] ) , <EOL> columns = pd . MultiIndex . from_arrays ( [ [ '<STR_LIT:a>' , '<STR_LIT:a>' , '<STR_LIT:b>' ] , [ '<STR_LIT:c>' , '<STR_LIT:d>' , '<STR_LIT:c>' ] ] ) ) <EOL> return df <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , pd . DataFrame , index = <NUM_LIT:2> , header = <NUM_LIT:1> ) <EOL> def read_df_1header_2namedindex ( x ) : <EOL> df = pd . DataFrame ( [ [ <NUM_LIT:1.> , <NUM_LIT> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ] , <EOL> index = pd . MultiIndex . from_arrays ( [ [ '<STR_LIT:a>' , '<STR_LIT:a>' , '<STR_LIT:b>' ] , [ <NUM_LIT:1.> , <NUM_LIT> , <NUM_LIT:1.> ] ] , names = [ '<STR_LIT>' , '<STR_LIT>' ] ) , <EOL> columns = [ '<STR_LIT:a>' , '<STR_LIT:d>' , '<STR_LIT:c>' ] ) <EOL> return frame_equal ( x , df ) <EOL> @ xw . func <EOL> def write_df_1header_2namedindex ( ) : <EOL> df = pd . DataFrame ( [ [ <NUM_LIT:1.> , <NUM_LIT> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ] , <EOL> index = pd . MultiIndex . from_arrays ( [ [ '<STR_LIT:a>' , '<STR_LIT:a>' , '<STR_LIT:b>' ] , [ <NUM_LIT:1.> , <NUM_LIT> , <NUM_LIT:1.> ] ] , names = [ '<STR_LIT>' , '<STR_LIT>' ] ) , <EOL> columns = [ '<STR_LIT:a>' , '<STR_LIT:d>' , '<STR_LIT:c>' ] ) <EOL> return df <EOL> @ xw . func <EOL> @ xw . arg ( '<STR_LIT:x>' , pd . DataFrame ) <EOL> def read_df_date_index ( x ) : <EOL> df = pd . DataFrame ( [ [ <NUM_LIT:1.> , <NUM_LIT> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ] , <EOL> index = [ datetime ( <NUM_LIT> , <NUM_LIT:12> , <NUM_LIT> ) , datetime ( <NUM_LIT> , <NUM_LIT:12> , <NUM_LIT> ) ] , <EOL> columns = [ '<STR_LIT:c>' , '<STR_LIT:d>' , '<STR_LIT:c>' ] ) <EOL> return frame_equal ( x , df ) <EOL> @ xw . func <EOL> def write_df_date_index ( ) : <EOL> df = pd . DataFrame ( [ [ <NUM_LIT:1.> , <NUM_LIT> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ] , <EOL> index = [ datetime ( <NUM_LIT> , <NUM_LIT:12> , <NUM_LIT> ) , datetime ( <NUM_LIT> , <NUM_LIT:12> , <NUM_LIT> ) ] , <EOL> columns = [ '<STR_LIT:c>' , '<STR_LIT:d>' , '<STR_LIT:c>' ] ) <EOL> return df <EOL> @ xw . func <EOL> def read_workbook_caller ( ) : <EOL> wb = xw . Workbook . caller ( ) <EOL> return xw . Range ( '<STR_LIT>' ) . value == <NUM_LIT:1.> <EOL> @ xw . func <EOL> def default_args ( x , y = "<STR_LIT:hello>" , z = <NUM_LIT:20> ) : <EOL> return <NUM_LIT:2> * x + <NUM_LIT:3> * len ( y ) + <NUM_LIT:7> * z <EOL> @ xw . func <EOL> def variable_args ( x , * z ) : <EOL> return <NUM_LIT:2> * x + <NUM_LIT:3> * len ( z ) + <NUM_LIT:7> * z [ <NUM_LIT:0> ] <EOL> @ xw . func <EOL> def optional_args ( x , y = None ) : <EOL> if y is None : <EOL> y = <NUM_LIT:10> <EOL> return x * y <EOL> @ xw . func <EOL> def write_none ( ) : <EOL> return None <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> xw . serve ( ) </s>
