Тёмный

Coding Gem #1.3: Parsing CSV Data as Lists in C# 

ParametricCamp
Подписаться 21 тыс.
Просмотров 27 тыс.
50% 1

Опубликовано:

 

21 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 32   
@jmoreno7554
@jmoreno7554 2 года назад
One of the best walk throughs Ive ever watched.
@kristhomas8295
@kristhomas8295 3 года назад
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!
@marcelobeani
@marcelobeani Год назад
You are a very good teacher, congrats man. It really worked for me.
@danielferrero211
@danielferrero211 4 месяца назад
Gracias por el video, me fue muy útil a pesar de que no domino el ingles perfectamente.
@SharaPk
@SharaPk 3 года назад
You explained everything, I loved that, thank you :)
@adamonjourney3726
@adamonjourney3726 3 года назад
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
@ParametricCamp 3 года назад
You are absolutely right, I have ran into this issue before, thanks for bringing it up!
@opafritzsche
@opafritzsche 2 года назад
@@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 ?
@AndreasDahl87
@AndreasDahl87 2 года назад
Great tutorial for hobby programmer :D Thanks a lot!
@jacobgandrup9865
@jacobgandrup9865 3 года назад
Thank you for this awesome and really helpful video, big thumps up!!
@charudattabangal5123
@charudattabangal5123 Год назад
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?
@bluefyr22
@bluefyr22 3 года назад
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.
@arfaouiarij8938
@arfaouiarij8938 Год назад
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?
@jeptho
@jeptho Год назад
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 🤞🏼
@leizedsanchez3521
@leizedsanchez3521 2 года назад
Excellent thanks!
@arturoordonez-hernandez8750
@arturoordonez-hernandez8750 3 года назад
Using C#'s verbatim (@"") strings is similar to HTML's tags.
@charliewhittaker1391
@charliewhittaker1391 3 года назад
Thanks for the tutorial dude! Do you know how to then sort these lists while keeping the data in the same columns? Many thanks
@jeodezman32
@jeodezman32 2 года назад
simple, pefrect.
@serj-nf7ll
@serj-nf7ll 7 месяцев назад
Tnx MAN!
@capitanrdc99
@capitanrdc99 2 года назад
thank you so much!!
@josoeI
@josoeI 3 года назад
Thank you so much
@haskell3702
@haskell3702 Год назад
What if the value contains the comma character?
@yaduvamshi9
@yaduvamshi9 2 года назад
How to print the data in another file rather than into console
@anhquantrannguyen20
@anhquantrannguyen20 3 года назад
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.
@brehiner25
@brehiner25 3 года назад
As I can see, you are printing by column but how can I print a specific row?
@adamonjourney3726
@adamonjourney3726 3 года назад
Console.WriteLine(csvLines[i]) in a loop
@hugohuaman1487
@hugohuaman1487 3 года назад
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 ?
@adamonjourney3726
@adamonjourney3726 3 года назад
declare a variable SUM outside a loop and count in loop like: SUM += columnWithNumbers[i];
@hamzadamiel7224
@hamzadamiel7224 3 года назад
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
@adamonjourney3726
@adamonjourney3726 3 года назад
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...
@rubeushagrid4131
@rubeushagrid4131 2 года назад
Csv is easy. Tell us about xlx
@aqilnoor2678
@aqilnoor2678 Год назад
Thank you, You made this easy to understand for me ru-vid.comgaming/emoji/7ff574f2/emoji_u1f44d.png
Далее
Coding Gem #1.2: What are CSV files?
9:11
Просмотров 2,6 тыс.
Coding Gem #1.4: Parsing CSV Data as Objects in C#
14:33
Human vs Jet Engine
00:19
Просмотров 117 млн
The Fastest Way to Modify a List in C# | Coding Demo
10:30
Intro to the CsvHelper Library for C#
27:12
Просмотров 27 тыс.
How to Load a CSV File to a DataGrid in WPF
15:32
Просмотров 2,8 тыс.
Creating Excel Files in C#
55:42
Просмотров 128 тыс.
How to Import CSV Data to a Database Using C#
16:10
Просмотров 25 тыс.
C# Read CSV - Tutorial
12:21
Просмотров 7 тыс.