Very simple C# CSV reader

You can try the some thing like the below LINQ snippet. string[] allLines = File.ReadAllLines(@”E:\Temp\data.csv”); var query = from line in allLines let data = line.Split(‘,’) select new { Device = data[0], SignalStrength = data[1], Location = data[2], Time = data[3], Age = Convert.ToInt16(data[4]) }; UPDATE: Over a period of time, things evolved. As of … Read more

Reversal of string.contains In python, pandas

You can use the tilde ~ to flip the bool values: >>> df = pd.DataFrame({“A”: [“Hello”, “this”, “World”, “apple”]}) >>> df.A.str.contains(“Hello|World”) 0 True 1 False 2 True 3 False Name: A, dtype: bool >>> ~df.A.str.contains(“Hello|World”) 0 False 1 True 2 False 3 True Name: A, dtype: bool >>> df[~df.A.str.contains(“Hello|World”)] A 1 this 3 apple [2 … Read more

How can I read a local file with Papa Parse?

The File API suggested by papaparse’s docs is meant for browser used. Assuming that you are running this on node at server side, what works for me is leveraging the readable stream: const fs = require(‘fs’); const papa = require(‘papaparse’); const file = fs.createReadStream(‘challenge.csv’); var count = 0; // cache the running count papa.parse(file, { … Read more