Reading LendingClub Data in C#

By on 9/26/2010

The micro-finance website lets you download a snapshot of their loan data for the purposes of analysis ... which is really cool, and not really a thing that financial companies are prone to do. If this is the kind of thing that interests you, I just wanted to show just how easy it was to read and parse this file
string filepath = @"c:\users\joel\downloads\loanstats.xml";

XDocument xml = XDocument.Load(filepath); var loansElements = xml.XPathSelectElements("//loan"); var loans = loansElements.Select(x => new { Id = x.Attribute("id").Value, AmountRequested = x.Attribute("amount-requested").Value, InterestRate = x.Attribute("interest-rate").Value // and so on });

foreach (var loan in loans) { Console.WriteLine("{0} - {1} @ {2}", loan.Id, loan.AmountRequested, loan.InterestRate); }

They also have each data file available as a CSV if you prefer to do things that way.

See more in the archives