title: Filter out low values from imported CSV file, remove currency formatting from CSV file within the program
body: <p>I've search around a bit prior to making a profile here in an attempt to alleviate the two mentioned problems.</p>
  
  <p>This is for appraisal purposes, I get a CSV file from a website that contains a list of neighborhood home prices and the year those properties were built. The price column in formatted to currency and the other is general. The purpose of the code is to return, in a text file, the high, low, and average values of both the year built and the price. By manually formatting the price column to general and searching for anomalous year built values (ie. a year built of 0 or 971) I can get the result I want. I have to change the currency format to general for the code to work. I would like to streamline the process by performing both the filtering of anomalous values and the formatting within the code if possible. </p>
  
  <p>Here is what I have so far:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Globalization;
  using System.IO;
  using System.Linq;
  using System.Text;
  using System.Text.RegularExpressions;
  using System.Threading.Tasks;
  
  namespace Prodominate_Values
  {
      class Program
      {
          static void Main(string[] args)
          {
              args = new[] { "C:/Users/Yeti/Desktop/Firm_Inventory.csv" };
  
              var transactions = ReadTransactions(args[0]);
  
              var averagePrice = CalculateAveragePrice(transactions);
              var averageYear = CalculateAverageYear(transactions);
  
              var lowPrice = transactions.Min(Transactions =&gt; Transactions.Price);
              var highPrice = transactions.Max(Transactions =&gt; Transactions.Price);
              var lowYear = transactions.Min(Transactions =&gt; Transactions.YearBuilt);
              var highYear = transactions.Max(Transactions =&gt; Transactions.YearBuilt);
  
              string[] lines = { lowPrice + " " + lowYear, highPrice + " " + highYear, averagePrice + " " + averageYear };
              File.WriteAllLines(@"C:/Users/Yeti/Desktop/Firm_Inventory.txt", lines);
              Console.WriteLine("Operation Completed");
              Console.ReadLine();
  
          }
  
          static IList&lt;Transaction&gt; ReadTransactions (string path)
          {
              var list = new List&lt;Transaction&gt;();
              foreach (var line in File.ReadLines(path).Skip(1))
              {
                  Console.WriteLine(line);
                  list.Add(Transaction.FromLine(line));
              }
  
              return list;
          }
  
          static int CalculateAveragePrice(IEnumerable&lt;Transaction&gt; transactions)
          {
              var count = 0;
              var total = 0;
  
              foreach (var transaction in transactions)
              {
                  count += 1;
                  total += transaction.Price;
              }
              return total / count;
          }
  
          static int CalculateAverageYear(IEnumerable&lt;Transaction&gt; transactions)
          {
              var count = 0;
              var total = 0;
  
              foreach (var transaction in transactions)
              {
                  count += 1;
                  total += transaction.YearBuilt;
              }
              return total / count;
          }
          class Transaction
          {
              public int Price { get; set; }
              public int YearBuilt { get; set; }
  
              public static Transaction FromLine(string line)
              {
                  var data = line.Split(',');
                  Console.WriteLine(Convert.ToString(int.Parse(data[1])));
  
                  return new Transaction()
                  {
                      Price = int.Parse(data[0]),
                      YearBuilt = int.Parse(data[1]),
                  };
              }
          }
      }
  }
  </code></pre>