Ejemplo n.º 1
0
        public void KeepRows()
        {
            MutableDataTable dt = GetTable();

            dt.KeepRows(row => row["last"] == "Jones");

            AnalyzeTests.AssertEquals(
                @"first,last
Fred,Jones
", dt);
        }
Ejemplo n.º 2
0
        // removes rows with empty data
        public static string CleanByRows(string filename, params string[] ignorecolumns)
        {
            MutableDataTable dt = DataAccess.DataTable.New.ReadCsv(filename);
            var xx = dt.ColumnNames
                     .Select((_, i) => { return(ignorecolumns.Contains(_) ? (int?)i : null); })
                     .Where(cv => cv != null);

            dt.KeepRows((_) =>
            {
                return(_.Values.Select((__, j) => __ != "" || xx.Contains(j)).All(g => g));
            });

            return(dt.SaveToString());
        }
Ejemplo n.º 3
0
        public void KeepRowsThrowsOnNull()
        {
            MutableDataTable dt = GetTable();

            Assert.Throws <ArgumentNullException>(() => dt.KeepRows(null));
        }