Ejemplo n.º 1
0
        // Read in a Ascii file that uses the given separate characters.
        // Like CSV.
        // Supports quotes to escape commas
        public static MutableDataTable Read(string filename, char separator = '\0', bool fAllowMismatch = false, string[] defaultColumns = null)
        {
            var dtLazy = new FileStreamingDataTable(filename, defaultColumns, separator);

            var dt = Utility.ToMutable(dtLazy);

            dt.Name = filename;
            return(dt);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Return an in-memory table that contains the topN rows from the table in the filename.
        /// </summary>
        /// <param name="builder">ignored</param>
        /// <param name="filename">filename of table to load. Schema is inferred from header row.</param>
        /// <param name="topN">reads the topN rows from the table.</param>
        /// <returns>a in-memory table containing the topN rows from the supplied file.</returns>
        public static MutableDataTable ReadSampleTopN(this DataTableBuilder builder, string filename, int topN = 100)
        {
            Debug.Assert(builder != null);
            if (filename == null)
            {
                throw new ArgumentNullException("filename");
            }

            DataTable        source = new FileStreamingDataTable(filename);
            MutableDataTable dt     = Analyze.SampleTopN(source, topN);

            return(dt);
        }
Ejemplo n.º 3
0
        // Read in a Ascii file that uses the given separate characters.
        // Like CSV.
        // Supports quotes to escape commas
        public static MutableDataTable Read(string filename, char separator = '\0', bool fAllowMismatch = false, string[] defaultColumns = null)
        {
            var dtLazy = new FileStreamingDataTable(filename, defaultColumns, separator);

            var dt = Utility.ToMutable(dtLazy);
            dt.Name = filename;
            return dt;
        }