def create_block(typestr, placement, item_shape=None, num_offset=<NUM_LIT:0>):
placement = BlockPlacement(placement)<EOL>num_items = len(placement)<EOL>if item_shape is None:<EOL><INDENT>item_shape = (N, )<EOL><DEDENT>shape = (num_items, ) + item_shape<EOL>mat = get_numeric_mat(shape)<EOL>if typestr in ('<STR_LIT:float>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT:int>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>values = mat.astype(typestr) + num_offset<EOL><DEDENT>elif typestr in ('<STR_LIT>', '<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>values = <NUM_LIT> * (mat.astype(typestr) + num_offset)<EOL><DEDENT>elif typestr in ('<STR_LIT:object>', '<STR_LIT:string>', '<STR_LIT:O>'):<EOL><INDENT>values = np.reshape(['<STR_LIT>' % i for i in mat.ravel() + num_offset],<EOL>shape)<EOL><DEDENT>elif typestr in ('<STR_LIT:b>', '<STR_LIT:bool>', ):<EOL><INDENT>values = np.ones(shape, dtype=np.bool_)<EOL><DEDENT>elif typestr in ('<STR_LIT>', '<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>values = (mat * <NUM_LIT>).astype('<STR_LIT>')<EOL><DEDENT>elif typestr.startswith('<STR_LIT>'):<EOL><INDENT>m = re.search(r'<STR_LIT>', typestr)<EOL>assert m is not None, "<STR_LIT>".format(typestr)<EOL>tz = m.groups()[<NUM_LIT:0>]<EOL>assert num_items == <NUM_LIT:1>, "<STR_LIT>"<EOL>values = DatetimeIndex(np.arange(N) * <NUM_LIT>, tz=tz)<EOL><DEDENT>elif typestr in ('<STR_LIT>', '<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>values = (mat * <NUM_LIT:1>).astype('<STR_LIT>')<EOL><DEDENT>elif typestr in ('<STR_LIT>', ):<EOL><INDENT>values = Categorical([<NUM_LIT:1>, <NUM_LIT:1>, <NUM_LIT:2>, <NUM_LIT:2>, <NUM_LIT:3>, <NUM_LIT:3>, <NUM_LIT:3>, <NUM_LIT:3>, <NUM_LIT:4>, <NUM_LIT:4>])<EOL><DEDENT>elif typestr in ('<STR_LIT>', ):<EOL><INDENT>values = Categorical(['<STR_LIT:a>', '<STR_LIT:a>', '<STR_LIT:a>', '<STR_LIT:a>', '<STR_LIT:b>', '<STR_LIT:b>', '<STR_LIT:c>', '<STR_LIT:c>', '<STR_LIT:c>', '<STR_LIT:d>'<EOL>])<EOL><DEDENT>elif typestr in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>assert shape[-<NUM_LIT:1>] == <NUM_LIT:10><EOL>assert all(s == <NUM_LIT:1> for s in shape[:-<NUM_LIT:1>])<EOL>if typestr.endswith('<STR_LIT>'):<EOL><INDENT>fill_value = np.nan<EOL><DEDENT>else:<EOL><INDENT>fill_value = <NUM_LIT:0.0><EOL><DEDENT>values = SparseArray([fill_value, fill_value, <NUM_LIT:1>, <NUM_LIT:2>, <NUM_LIT:3>, fill_value,<EOL><NUM_LIT:4>, <NUM_LIT:5>, fill_value, <NUM_LIT:6>], fill_value=fill_value)<EOL>arr = values.sp_values.view()<EOL>arr += (num_offset - <NUM_LIT:1>)<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>' % typestr)<EOL><DEDENT>return make_block(values, placement=placement, ndim=len(shape))<EOL>
Supported typestr:

    * float, f8, f4, f2
    * int, i8, i4, i2, i1
    * uint, u8, u4, u2, u1
    * complex, c16, c8
    * bool
    * object, string, O
    * datetime, dt, M8[ns], M8[ns, tz]
    * timedelta, td, m8[ns]
    * sparse (SparseArray with fill_value=0.0)
    * sparse_na (SparseArray with fill_value=np.nan)
    * category, category2