returns a string version of the CSV
183068
def toStr(self) :
		""""""
		s = [self.strLegend]
		for l in self.lines :
			s.append(l.toStr())
		return self.lineSeparator.join(s)
205176
def _get_example_csv(self):
        
        station_key = self.json["station"][0]["key"]
        period = "corrected-archive"
        url = self.url\
                  .replace(".json", "/station/{}/period/{}/data.csv"\
                  .format(station_key, period))

        r = requests.get(url)
        if r.status_code == 200:
            return DataCsv().from_string(r.content)
        else:
            raise Exception("Error connecting to api")
919770
private String createCSV() {

        String csvData = null;

        if (isAggregate())
            csvData = createAggregatedProjectCSV();
        else
            csvData = createMultiProjectCSV();

        return csvData;
    }
870295
def CopyToString(self):
    
    if self.name is not None and self.row_identifier is not None:
      return '{0:s}.{1:d}'.format(self.name, self.row_identifier)

    return None
745809
def get_csv_header(fname, sep=','):
    
    with open(fname, encoding='utf-8-sig') as f:
        return next(f).split(sep)
113907
def to_csv(local_config = nil)
      csv_options = options.merge(local_options(local_config))
      rows = padded_rows.map do |data|
        CSV::Row.new(@header.mapped_columns, data, false)
      end

      if csv_options[:write_headers] && rows.empty?
        rows << CSV::Row.new(@header.mapped_columns, [], true)
      end

      table = CSV::Table.new(rows)
      csv_options.except!(*custom_options.keys)
      table.to_csv(csv_options)
    end
1277043
def csv_string_io(sql, fetch_size = 1000)
      results = @statement.execute_query(sql)
      results.set_fetch_size(fetch_size)

      column_count = results.get_meta_data.get_column_count
      headers = 1.upto(column_count).map{|i| results.get_meta_data.get_column_name(i)}

      enum = Enumerator.new do |y|
        finished = false
        while(!finished) do
          rows = []
          csv_string = CSV.generate do |csv|

            fetch_size.times do
              unless results.next
                finished = true
                break
              end
              values = 1.upto(column_count).map{|i| to_ruby_type(results.get_object(i)) }
              csv << values
            end
          end
          y << StringIO.new(csv_string)
        end
      end

      return [headers, enum]
    end
784163
def serialize(self, value):
    """"""
    if six.PY2:
      # In Python2 csv.writer doesn't accept unicode, so we convert to UTF-8.
      output = io.BytesIO()
      csv.writer(output).writerow([unicode(x).encode('utf-8') for x in value])
      serialized_value = output.getvalue().decode('utf-8').strip()
    else:
      # In Python3 csv.writer expects a text stream.
      output = io.StringIO()
      csv.writer(output).writerow([str(x) for x in value])
      serialized_value = output.getvalue().strip()

    # We need the returned value to be pure ascii or Unicodes so that
    # when the xml help is generated they are usefully encodable.
    return _helpers.StrOrUnicode(serialized_value)
993179
def render_csv(t)
      io = StringIO.new
      io.puts (
        t.header.collect do |v|
          v ? "\"#{v.to_s.gsub(/"/, '""')}\"" : ""
        end.join(',')
      ) unless @options[:plain]
      t.each do |row|
        next if row === t.header
        io.puts (
          row.collect do |v|
            v ? "\"#{v.to_s.gsub(/"/, '""')}\"" : ""
          end.join(',')
        )
      end
      io.rewind
      io.gets(nil).encode(crlf_newline: true)
    end
501199
def format_csv(self, delim=',', qu='"'):
        
        res = qu + self.name + qu + delim
        if self.data:
            for d in self.data:
                res += qu + str(d) + qu + delim
        return res + '\n'
981279
def get_as_csv(self, output_file_path: Optional[str] = None) -> str:
        
        output = StringIO() if not output_file_path else open(output_file_path, 'w')
        try:
            csv_writer = csv.writer(output)

            csv_writer.writerow(self.columns)
            for row in self.rows:
                csv_writer.writerow(row)
            output.seek(0)
            return output.read()
        finally:
            output.close()
335957
private byte[] getCSVOutput(List<String[]> lines)
    {
        StringWriter writer = new StringWriter();
        csv = new CSVWriter(writer, delimiter.separator().charAt(0));
        for(int i = 0; i < lines.size(); i++)
        {
            csv.writeNext((String[])lines.get(i), quotes);
        }

        // The contents returned is the CSV string
        return writer.toString().getBytes();
    }
942365
public String listCsv() {

        StringBuffer csv = new StringBuffer(5120);
        csv.append(m_metadata.csvHeader());
        if (getContent().isEmpty()) {
            csv.append(m_metadata.csvEmptyList());
        } else {
            Iterator<CmsListItem> itItems = getContent().iterator();
            while (itItems.hasNext()) {
                CmsListItem item = itItems.next();
                csv.append(m_metadata.csvItem(item));
            }
        }
        return getWp().resolveMacros(csv.toString());
    }
483039
def make_csv(self):
        
        import csv
        try:
            from StringIO import StringIO  # Python 2.7
        except ImportError:
            from io import StringIO

        out = StringIO()
        writer = csv.writer(out, delimiter='|', lineterminator='\n', quoting=csv.QUOTE_MINIMAL)

        if self.function == 'total':
            writer.writerows(self.results)                

        elif self.function == 'top':
            rows = [['Value', self.headers.strip('"')]]
            if self.results[0] is not None:
                for res in self.results:
                    if res is not None:
                        rows.append(tuple([res[0], ','.join(res[1])]))
                writer.writerows(rows)
                
        elif self.function == 'table':
            rows = [[header.strip('"') for header in re.split('\s*,\s*', self.headers)]]

            for res in sorted(self.results, key=lambda x: x[0]):
                row = list(res[:-1])
                lastcol = get_fmt_results(res[-1], limit=10)
                if lastcol[-1][0] == '[' and lastcol[-1][-1] == ']':
                    row.append(u'{0} {1}'.format(u', '.join(lastcol[:-1]), lastcol[-1]))
                else:
                    row.append(u', '.join(lastcol))
                rows.append(row)
            writer.writerows(rows)

        self.csv = out.getvalue()
385760
def _csv_str(self, param, stats, quantiles, index=None):
        """"""

        buffer = param
        if not index:
            buffer += ', '
        else:
            buffer += '_' + '_'.join([str(i) for i in index]) + ', '

        for stat in ('mean', 'standard deviation', 'mc error'):
            buffer += str(stats[stat][index]) + ', '

        # Index to interval label
        iindex = [key.split()[-1] for key in stats.keys()].index('interval')
        interval = list(stats.keys())[iindex]
        buffer += ', '.join(stats[interval].T[index].astype(str))

        # Process quantiles
        qvalues = stats['quantiles']
        for q in quantiles:
            buffer += ', ' + str(qvalues[q][index])

        return buffer + '\n'
328147
def reader(f):
    ''''''
    return unicodecsv.reader(f, encoding='utf-8', delimiter=b',', quotechar=b'"')
1052345
def csv(self, **kwargs):
        
        out = StringIO()
        writer = csv.DictWriter(out, self.columns, **kwargs)
        writer.writerow(dict(zip(self.columns, self.columns)))
        writer.writerows(dict(row.items()) for row in self.rows)
        
        return out