I cannot stress how good this was. You didn't leave anything out in my opinion, everything was explained beautifully. I came here with the intent to review something I thought I already knew, and left here learning a lot. Thanks!
Thank you for this great tutorial. Again learned new things. Btw: in countries with comma-decimal numbers we have to use System.Globalization.CultureInfo.InvariantCulture to Convert DoubleNumbers... otherwise 49.0(string) will be converted to 490(!). exp.: double g = Convert.ToDouble(rawData[7], CultureInfo.InvariantCulture);
@@ParametricCamp YOU ARE BRILLANT! This is exactly what i am searching for. *BUT* there is one Problem for me: i need this, inside a C# Form ( UI Form for Windows ) is there something to find on your channel? Also i have a *LOT* of data, 1 CSV String to be split = 71 special Colums. Than i have a not know Amount of rows. So i need 71 Lists with Special colum data + unknown amount of rows all contains 71 Lists. Did you think this will be possible, or is this just **TO MUCH** to split ?
this was amazingly helpful! thank you. I've been trying to figure out how to pull csv data into an array that i could then randomize and output different combinations.
Thank you for simplifying this ! However, I have a question : So if the csv file have more than one "table", meaning that more than one header. For example : Name , last name and underneath the data for those and then address and email and the corresponding data underneath. How do I do with that?
Thank you for this great video,but I have a question regarding scientific notation. My csv file contains scientific notations, so is there any way to get rid of those?
Just want to say thank you for the lecture. I tried to repeat the example with a random csv file I took from Autodesk Revit Mechanical/ Piping family (US - metric). I couldn't convert string list with decimal number (i.e 12.987) to double although I checked the csv carefully by inserting it as data into Excel for observing. Finally, I have achieved it by using Double.Parse method with changing IFormatProvider formating to the "en-US". Things I have learned from Double.Parse method is I also can use Double.TryParse method to verify if there is an odd format in a row/ column list.
Great video. I have a csv where a row contains a customer number, a price and a item number. If the customer has multiple items with the same item number, it displays in the csv as a line for each item. How would you sum the price for each customer, for each item. Example: Customernumber, 150.50, itemnumber1 Customernumber, 300, itemnumber2 Customernumber, 150.5, itemnumber1 The result should be customernumber, 301.0, itemnumber1 Customernumber, 300, itemnumber2 Hope it makes sense. Thank you in advance 🤞🏼
I cannot stress how good this was. You didn't leave anything out in my opinion, everything was explained beautifully. I came here with the intent to review something I thought I already knew, and left here learning a lot. Thanks!
One of the best walk throughs Ive ever watched.
You are a very good teacher, congrats man. It really worked for me.
You explained everything, I loved that, thank you :)
Thank you for this great tutorial. Again learned new things. Btw: in countries with comma-decimal numbers we have to use System.Globalization.CultureInfo.InvariantCulture to Convert DoubleNumbers... otherwise 49.0(string) will be converted to 490(!). exp.: double g = Convert.ToDouble(rawData[7], CultureInfo.InvariantCulture);
You are absolutely right, I have ran into this issue before, thanks for bringing it up!
@@ParametricCamp YOU ARE BRILLANT! This is exactly what i am searching for.
*BUT* there is one Problem for me:
i need this, inside a C# Form ( UI Form for Windows ) is there something to find on your channel?
Also i have a *LOT* of data, 1 CSV String to be split = 71 special Colums.
Than i have a not know Amount of rows.
So i need 71 Lists with Special colum data
+ unknown amount of rows all contains 71 Lists.
Did you think this will be possible, or is this just **TO MUCH** to split ?
Gracias por el video, me fue muy útil a pesar de que no domino el ingles perfectamente.
this was amazingly helpful! thank you. I've been trying to figure out how to pull csv data into an array that i could then randomize and output different combinations.
Great tutorial for hobby programmer :D Thanks a lot!
Thank you for this awesome and really helpful video, big thumps up!!
Thank you for simplifying this ! However, I have a question : So if the csv file have more than one "table", meaning that more than one header. For example : Name , last name and underneath the data for those and then address and email and the corresponding data underneath. How do I do with that?
Thank you for this great video,but I have a question regarding scientific notation.
My csv file contains scientific notations, so is there any way to get rid of those?
Just want to say thank you for the lecture.
I tried to repeat the example with a random csv file I took from Autodesk Revit Mechanical/ Piping family (US - metric). I couldn't convert string list with decimal number (i.e 12.987) to double although I checked the csv carefully by inserting it as data into Excel for observing.
Finally, I have achieved it by using Double.Parse method with changing IFormatProvider formating to the "en-US". Things I have learned from Double.Parse method is I also can use Double.TryParse method to verify if there is an odd format in a row/ column list.
Thanks for the tutorial dude! Do you know how to then sort these lists while keeping the data in the same columns?
Many thanks
Using C#'s verbatim (@"") strings is similar to HTML's tags.
What if the value contains the comma character?
Excellent thanks!
How to print the data in another file rather than into console
Great video.
I have a csv where a row contains a customer number, a price and a item number. If the customer has multiple items with the same item number, it displays in the csv as a line for each item.
How would you sum the price for each customer, for each item.
Example:
Customernumber, 150.50, itemnumber1
Customernumber, 300, itemnumber2
Customernumber, 150.5, itemnumber1
The result should be customernumber, 301.0, itemnumber1
Customernumber, 300, itemnumber2
Hope it makes sense.
Thank you in advance 🤞🏼
thank you so much!!
As I can see, you are printing by column but how can I print a specific row?
Console.WriteLine(csvLines[i]) in a loop
how do i read a row and then put it in a list that can allow me to access the individual elements in the row
Maybe you can use a jagged list like:
static void Main()
{
// Read the contents of the CSV file (as lines into array)
string[] rawLinesCSV = System.IO.File.ReadAllLines(@"C:\grades.csv");
// Count lines
var dataRows = rawLinesCSV.Count();
string[][] jaggedArray = new string[dataRows-1][]; // without headerRow
for (int i = 0; i < dataRows - 1; i++)
{
Console.WriteLine("i: " + i + " : rowData: " + rawLinesCSV[i + 1]);
jaggedArray[i] = rawLinesCSV[i + 1].Split(',');
}
for (int i = 0; i < jaggedArray.Length; i++)
{
for (int j = 0; j < jaggedArray[i].Length; j++)
{
System.Console.Write("jaggedArray[{0}][{1}]: ", i,j);
System.Console.WriteLine("{0}{1}", jaggedArray[i][j], j == (jaggedArray[i].Length - 1) ? "" : " ");
}
System.Console.WriteLine();
}
Console.ReadKey();
}
#####
Output:
jaggedArray[0][0]: Alfalfa
jaggedArray[0][1]: Aloysius
jaggedArray[0][2]: 123-45-6789
jaggedArray[0][3]: 40.0
jaggedArray[0][4]: 90.0
jaggedArray[0][5]: 100.0
jaggedArray[0][6]: 83.0
jaggedArray[0][7]: 49.0
jaggedArray[0][8]: D-
jaggedArray[1][0]: Alfred
jaggedArray[1][1]: University
jaggedArray[1][2]: 123-12-1234
jaggedArray[1][3]: 41.0
jaggedArray[1][4]: 97.0
jaggedArray[1][5]: 96.0
jaggedArray[1][6]: 97.0
jaggedArray[1][7]: 48.0
jaggedArray[1][8]: D+
and so on...
But how can I make a sum ? I mean if int the list of double there are the values 1 2 3 and I want to sum these 3 values how can I do that ?
declare a variable SUM outside a loop and count in loop like: SUM += columnWithNumbers[i];
Tnx MAN!
simple, pefrect.
Thank you so much
Csv is easy. Tell us about xlx
Thank you, You made this easy to understand for me
ruclips.net/user/sgaming/emoji/7ff574f2/emoji_u1f44d.png