Ejemplo n.º 1
0
 public static StreamingDataFrame ReadCsv(string[] filenames,
                                          char sep          = ',', bool header = true,
                                          string[] names    = null, ColumnType[] dtypes = null,
                                          int nrows         = -1, int guess_rows        = 10,
                                          Encoding encoding = null, bool useThreads     = true,
                                          bool index        = false, IHost host         = null)
 {
     return(new StreamingDataFrame(DataFrameIO.ReadCsvToTextLoader(filenames, sep, header, names, dtypes, nrows, guess_rows,
                                                                   encoding, useThreads, index, host)));
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Converts the data frame into a string.
 /// </summary>
 public override string ToString()
 {
     using (var stream = new MemoryStream())
     {
         DataFrameIO.ViewToCsv(this, stream);
         stream.Position = 0;
         using (var reader = new StreamReader(stream))
             return(reader.ReadToEnd().Replace("\r", "").TrimEnd(new char[] { '\n' }));
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Converts the data frame into a string.
        /// Every vector column is skipped.
        /// </summary>
        public override string ToString()
        {
            var df = HasVectorColumn() ? Flatten() : this;

            using (var stream = new MemoryStream())
            {
                DataFrameIO.ViewToCsv(df, stream, silent: true);
                stream.Position = 0;
                using (var reader = new StreamReader(stream))
                    return(reader.ReadToEnd().Replace("\r", "").TrimEnd(new char[] { '\n' }));
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Saves the dataframe as a file.
 /// </summary>
 /// <param name="filename">filename</param>
 /// <param name="sep">column separator</param>
 /// <param name="header">add header</param>
 /// <param name="encoding">encoding</param>
 /// <param name="silent">Suppress any info output (not warnings or errors)</param>
 public void ToCsv(string filename, string sep = ",", bool header  = true,
                   Encoding encoding           = null, bool silent = false, IHost host = null)
 {
     DataFrameIO.ViewToCsv(this, filename, sep: sep, header: header, encoding: encoding, silent: silent, host: host);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Converts into <see cref="DataFrame"/>.
 /// </summary>
 /// <param name="sep">column separator</param>
 /// <param name="nrows">number of rows to read</param>
 /// <param name="keepVectors">keep vectors as they are</param>
 /// <param name="numThreads">number of threads to use to fill the dataframe</param>
 /// <returns><see cref="DataFrame"/></returns>
 public DataFrame ToDataFrame(int nrows = -1, bool keepVectors = false, int?numThreads = 1)
 {
     return(DataFrameIO.ReadView(Source, nrows, keepVectors, numThreads, _env));
 }