def write_data(self, chunksize, dropna=False):
names = self.dtype.names<EOL>nrows = self.nrows_expected<EOL>masks = []<EOL>if dropna:<EOL><INDENT>for a in self.values_axes:<EOL><INDENT>mask = isna(a.data).all(axis=<NUM_LIT:0>)<EOL>if isinstance(mask, np.ndarray):<EOL><INDENT>masks.append(mask.astype('<STR_LIT>', copy=False))<EOL><DEDENT><DEDENT><DEDENT>if len(masks):<EOL><INDENT>mask = masks[<NUM_LIT:0>]<EOL>for m in masks[<NUM_LIT:1>:]:<EOL><INDENT>mask = mask & m<EOL><DEDENT>mask = mask.ravel()<EOL><DEDENT>else:<EOL><INDENT>mask = None<EOL><DEDENT>indexes = [a.cvalues for a in self.index_axes]<EOL>nindexes = len(indexes)<EOL>bindexes = []<EOL>for i, idx in enumerate(indexes):<EOL><INDENT>if i > <NUM_LIT:0> and i < nindexes:<EOL><INDENT>repeater = np.prod(<EOL>[indexes[bi].shape[<NUM_LIT:0>] for bi in range(<NUM_LIT:0>, i)])<EOL>idx = np.tile(idx, repeater)<EOL><DEDENT>if i < nindexes - <NUM_LIT:1>:<EOL><INDENT>repeater = np.prod([indexes[bi].shape[<NUM_LIT:0>]<EOL>for bi in range(i + <NUM_LIT:1>, nindexes)])<EOL>idx = np.repeat(idx, repeater)<EOL><DEDENT>bindexes.append(idx)<EOL><DEDENT>values = [a.take_data() for a in self.values_axes]<EOL>values = [v.transpose(np.roll(np.arange(v.ndim), v.ndim - <NUM_LIT:1>))<EOL>for v in values]<EOL>bvalues = []<EOL>for i, v in enumerate(values):<EOL><INDENT>new_shape = (nrows,) + self.dtype[names[nindexes + i]].shape<EOL>bvalues.append(values[i].reshape(new_shape))<EOL><DEDENT>if chunksize is None:<EOL><INDENT>chunksize = <NUM_LIT><EOL><DEDENT>rows = np.empty(min(chunksize, nrows), dtype=self.dtype)<EOL>chunks = int(nrows / chunksize) + <NUM_LIT:1><EOL>for i in range(chunks):<EOL><INDENT>start_i = i * chunksize<EOL>end_i = min((i + <NUM_LIT:1>) * chunksize, nrows)<EOL>if start_i >= end_i:<EOL><INDENT>break<EOL><DEDENT>self.write_data_chunk(<EOL>rows,<EOL>indexes=[a[start_i:end_i] for a in bindexes],<EOL>mask=mask[start_i:end_i] if mask is not None else None,<EOL>values=[v[start_i:end_i] for v in bvalues])<EOL><DEDENT>
we form the data into a 2-d including indexes,values,mask
            write chunk-by-chunk