How to pull data from a CSV file in Python

  Рет қаралды 77,407

Chewy

Chewy

Күн бұрын

Hello everyone, today's video is a short one but a good one. I have been using CSV files a lot in my current project for my data structures and algorithms 2 class. I had a lot of issues early on trying to get the data in to the lists and print it so I figured this would be a good video. Let me know what you think in the comments and please subscribe if you are not yet, I'm trying to get to the 1000 subs mark :).
discord: / discord
Peter-Pyke on GitHub

Пікірлер: 42
@ateabag8410
@ateabag8410 4 ай бұрын
Thank you so much ! My teacher didn't explain even what is a csv file but gave a task to do. Thank you, you're my savior
@Chewy21414
@Chewy21414 4 ай бұрын
@@ateabag8410 glad it helped
@thefrub
@thefrub Жыл бұрын
Thank you for the explanation, I'm working on a project that has almost this exact problem rn and this helped me understand it better
@Chewy21414
@Chewy21414 Жыл бұрын
Glad it helped thank you for watching ☺️
@lomar-om6hc
@lomar-om6hc 10 ай бұрын
Thank you so much for your video! I’ve learned a lot! I have one question, how am I able to do the exact same function without csv.reader? My professor doesn’t want us using that, and I’m not sure how else to do it.
@Chewy21414
@Chewy21414 10 ай бұрын
I wish I could be more helpful but it's been so long time since I did this video I really don't know. I haven't had to do anything with data and CSV files in a long time. I have been trying to learn C# and Unity/game development.
@lomar-om6hc
@lomar-om6hc 10 ай бұрын
@@Chewy21414 that’s alright, I understand! Thank you for your help and responding back! I really appreciate it!
@esmaben1
@esmaben1 11 ай бұрын
Thank you for this video! I have a question: How to would be, if i want that myList had a array of objects?
@Chewy21414
@Chewy21414 11 ай бұрын
Hey I'm glad you liked the video. Unfortunately I haven't done anything with python in a while so I don't know the answer to your question right now. I haven't kept up with this type of coding since I finished college. However maybe this could help? stackoverflow.com/questions/7925539/store-and-retrieve-objects-from-python-lists
@dragrobin
@dragrobin 4 ай бұрын
bro i love you, now i new to learn how to save this data
@Chewy21414
@Chewy21414 4 ай бұрын
@@dragrobin glad it helped seems like a lot of people needed this video lol
@siphosakhesiqiniseko8561
@siphosakhesiqiniseko8561 2 ай бұрын
In my my pycharm(windows) 2024 it is not working, how do I link up the data with my project??
@KristopherWeitlauf
@KristopherWeitlauf Жыл бұрын
Thanks for the video. I have a question. I am trying to take 9 different raw data files, convert to csv, parse as needed, fix missing values, etc. Run exploratory analysis on the csv using python. Then I have to take those 9 files and combine into one file and run exploratory analysis. Do I need to use excel to convert to CSV first for each one or can I use python to perform that function for me. How do I import the files into my python project so I do not have to use pathways? I appreciate any help. Good video.
@Chewy21414
@Chewy21414 Жыл бұрын
Hey thank you for watching. I don't recall a time where I had to convert files but I'm pretty sure python has a function that can handle converting the files to csv. Importing the files into your project is just a matter of saving the files in the correct location. If you save them inside a fold where your project is you should be able to access them without having to use an absolute file path. Not sure if that helps much but hope you are able to figure it out and complete your project.
@adey1434
@adey1434 2 жыл бұрын
How can we extract data against specific date from column?
@yaweli2968
@yaweli2968 2 жыл бұрын
I wish you could show how to extract specific columns, but thanks for the video
@Chewy21414
@Chewy21414 2 жыл бұрын
I have a couple other videos on text files that might help check my playlists. I thought I went over that in one of them it's been awhile since I did it though so I'm not sure.
@yaweli2968
@yaweli2968 2 жыл бұрын
Please drop a link. I have trying to look it up
@Chewy21414
@Chewy21414 2 жыл бұрын
@@yaweli2968 try one of these videos kzbin.info/www/bejne/rKOvkJZmodZ_i6c kzbin.info/www/bejne/eGLKmIaknbKse7M
@vanishreevelmurugan7225
@vanishreevelmurugan7225 Жыл бұрын
what is the tool you are working now? i have downloaded python setup but my screen is not same as you working in the video now. Please tell me what to install to type the code like you do
@Chewy21414
@Chewy21414 Жыл бұрын
I am using IntelliJ, I have a video on how to set python up with it. kzbin.info/www/bejne/hYeZnGZpfK1ljM0
@adanordonez7241
@adanordonez7241 Жыл бұрын
In 5:50, how can I append to the list all the values that are located in just one column?
@Chewy21414
@Chewy21414 Жыл бұрын
It's been awhile since I have done anything with text files in Python. But if I were to do it I think I would just set up a loop to modify the particular index from each row that I wanted. Again like I said I haven't done much with python in awhile so sorry if my answer is not very helpful. If you figure out how to do it though reply to this comment with the answer so the other people looking to do the same will have the answer.
@BitaAzari-y1k
@BitaAzari-y1k 4 ай бұрын
thank you , how can i let user drag and drop csv file without need of addressing csv file everytime e.g. filename.csv
@Chewy21414
@Chewy21414 4 ай бұрын
I'm not sure I have always used the way I show here. I haven't really explored more with CSV files since I finished college.
@sagarsrinivas457
@sagarsrinivas457 Жыл бұрын
how to extract text (if possible specific section text ) from multiple resume extension as doc,docx, pdf and save all into a new csv file in 3 row data entry system.
@Chewy21414
@Chewy21414 Жыл бұрын
I am not sure at this point. I haven't done a lot with text files and python in a while I have been learning #C and game development in Unity.
@discere5811
@discere5811 2 жыл бұрын
I am getting an error; NameError: name 'filename' is not defined how do I fix this? I hope you answer my question, thank you in advance.
@Chewy21414
@Chewy21414 2 жыл бұрын
Do you have the import csv at the top?
@Chewy21414
@Chewy21414 2 жыл бұрын
Also make sure you have filename as a parameter of the load_data function.
@prisharai792
@prisharai792 Жыл бұрын
what software is this?
@Chewy21414
@Chewy21414 Жыл бұрын
The IDE called IntelliJ I have a video on my KZbin about how to set up Python inside IntelliJ.
@prisharai792
@prisharai792 Жыл бұрын
okay thanks@@Chewy21414
@reddeadcobra8295
@reddeadcobra8295 2 жыл бұрын
Let’s say I have a csv file with 2 columns. I have years on one column and sales amount in the second. The issue I am having is that I don’t know how to make a list with the year because I need to calculate the means for them. How would I create a list with all the years
@robn2497
@robn2497 Жыл бұрын
once you have a list of lists, example = [[year , sales_amount] , [1999, 10,000 ], [2000, 15,000], [2001, 17,000] ] to access the year 1999 use index 1 which maps too [1999, 10,000 ], so A = example[1], A will now contain [1999, 10,000 ], u can now access the year --> 1999 OR sales--> 10,000 using indexing again, B =A[0] would be 1999 OR C =A[1] would be 10,000 remember python indexes start from zero so 1st element [0] 2nd [1] 3rd [2] ect ect. Its just a 2 step process, you could write a loop to do this systematically append() to make a list containing whatever you wanted to average (find the mean).
@martinruzi
@martinruzi 4 ай бұрын
thanks man
@Chewy21414
@Chewy21414 4 ай бұрын
@@martinruzi np glad it helped
@thippeswamykv2527
@thippeswamykv2527 2 жыл бұрын
how to store the data in CSV FILES proper format using python
@Chewy21414
@Chewy21414 2 жыл бұрын
Are you asking how to explort data from a python project into a csv file in a certain format? I have a few other videos on my channel with text files check those out and if you still have questions feel free to join my discord and chat.
@thippeswamykv2527
@thippeswamykv2527 2 жыл бұрын
@@Chewy21414 That's grate thanks if you don't ,mind can you please share the vdo link
@Chewy21414
@Chewy21414 2 жыл бұрын
@@thippeswamykv2527 Here are the links to the other two videos and also the link to my discord kzbin.info/www/bejne/eGLKmIaknbKse7M kzbin.info/www/bejne/rKOvkJZmodZ_i6c discord.gg/KehtBFGh
@TheCopperMystic
@TheCopperMystic 11 ай бұрын
You are so handsome and your voice. Gosh!
Python Tutorial: CSV Module - How to Read, Parse, and Write CSV Files
16:12
Wednesday VS Enid: Who is The Best Mommy? #shorts
0:14
Troom Oki Toki
Рет қаралды 50 МЛН
24 Часа в БОУЛИНГЕ !
27:03
A4
Рет қаралды 7 МЛН
УЛИЧНЫЕ МУЗЫКАНТЫ В СОЧИ 🤘🏻
0:33
РОК ЗАВОД
Рет қаралды 7 МЛН
Extract Data From Multiple Files | Python CSV File Handling
38:09
Python Tutorial: File Objects - Reading and Writing to Files
24:33
Corey Schafer
Рет қаралды 1,8 МЛН
5 Good Python Habits
17:35
Indently
Рет қаралды 714 М.
Using Excel .xlsx files with Python! OpenPyXl Tutorial
7:23
LeMaster Tech
Рет қаралды 85 М.
Learn HOW to Read CSV Files in Python!
6:35
Earthly
Рет қаралды 17 М.
Wednesday VS Enid: Who is The Best Mommy? #shorts
0:14
Troom Oki Toki
Рет қаралды 50 МЛН