def export_to(self, file_or_path, data_frame_max_size=30000):
        from math import ceil
        # get record count
        record_count = self._query_mongo(query=self.filter_query, count=True)

        self.ordered_columns = OrderedDict()
        self._build_ordered_columns(self.dd.survey, self.ordered_columns)

        # pandas will only export 30k records in a dataframe to a csv
        # - we need to create multiple 30k dataframes if required,
        # we need to go through all the records though so that
        # we can figure out the columns we need for repeats
        datas = []
        num_data_frames = \
            int(ceil(float(data_frame_max_size) / float(record_count)))
        for i in range(num_data_frames):
            cursor = self._query_mongo(
                self.filter_query, start=(i * data_frame_max_size),
                limit=data_frame_max_size)
            data = self._format_for_dataframe(cursor)
            datas.append(data)

        columns = list(chain.from_iterable(
            [[xpath] if cols is None else cols
             for xpath, cols in self.ordered_columns.iteritems()]))

        # use a different group delimiter if needed
        if self.group_delimiter != DEFAULT_GROUP_DELIMITER:
            columns = [self.group_delimiter.join(col.split("/"))
                       for col in columns]

        # add extra columns
        columns += [col for col in self.ADDITIONAL_COLUMNS]

        header = True
        if hasattr(file_or_path, 'read'):
            csv_file = file_or_path
            close = False
        else:
            csv_file = open(file_or_path, "wb")
            close = True

        for data in datas:
            writer = CSVDataFrameWriter(data, columns)
            writer.write_to_csv(csv_file, header=header)
            header = False
        if close:
            csv_file.close()
dataset/ETHPy150Open kobotoolbox/kobocat/onadata/apps/viewer/pandas_mongo_bridge.py/CSVDataFrameBuilder.export_to/swapped operands of `/`