Пример #1
0
 static void PrintDataFrame(DataFrame df)
 {
     Iterator.IIterator it = df.GetIterator();
     do
     {
         Record cr = it.Current();
         if (cr == null)
         {
             return;
         }
         Console.WriteLine(cr.Name + " " + cr.Surname + " " + cr.Gender + " " + cr.Age);
     }while (it.Next());
 }
Пример #2
0
        static Tuple <string, double> Mode(DataFrame df)
        {
            int male   = 0;
            int female = 0;

            Iterator.IIterator it = df.GetIterator();
            do
            {
                Record cr = it.Current();
                if (cr == null)
                {
                    return(null);
                }
                if (cr.Gender.Contains("M"))
                {
                    male++;
                }
                else
                {
                    female++;
                }
            }while (it.Next());

            string most  = "";
            double ratio = 0;

            if (male > female)
            {
                most  = "Male";
                ratio = (double)male * 100 / (female + male);
            }
            else
            {
                most  = "Female";
                ratio = (double)female * 100 / (female + male);
            }

            return(Tuple.Create(most, ratio));
        }