CSV Column To Python List

  Рет қаралды 35,050

DataEng Uncomplicated

DataEng Uncomplicated

Күн бұрын

Пікірлер: 44
@mansoorghumro8404
@mansoorghumro8404 3 жыл бұрын
Thank you.... I have been searching on how to convert a column in a csv to a list / dynamically calculate the number of unique elements in a HUGE csv file... or rather, since I'm so new to programming, didn't even know what to ask. You are a great help my friend. Be blessed!
@DataEngUncomplicated
@DataEngUncomplicated 3 жыл бұрын
I'm glad the video was helpful! Thank you for leaving a comment!
@nishantkumar-lw6ce
@nishantkumar-lw6ce 3 жыл бұрын
You could also use pandas library to convert to list.
@tarunsoni2764
@tarunsoni2764 3 жыл бұрын
BRUHHHH, literally , you solved my problem. actually i was given a csv file of almost 3000 rows and 5 column, and i was asked to calculate covariances , correlations, it helped me completely
@DataEngUncomplicated
@DataEngUncomplicated 3 жыл бұрын
Hey Tarun, glad you found it helpful. Thanks for watching!
@richardallen1555
@richardallen1555 Жыл бұрын
i spent two days looking for a way to do my assignment and this 5 minute video was all i needed, i really need to get better at searching for what i dont know haha
@DataEngUncomplicated
@DataEngUncomplicated Жыл бұрын
I'm glad it was helpful!
@teach4944
@teach4944 2 жыл бұрын
you just safed me hours of typing. thanks a lot
@DataEngUncomplicated
@DataEngUncomplicated 2 жыл бұрын
You're welcome Joshua!
@the_dev_life
@the_dev_life 3 жыл бұрын
Very useful video! Well paced and very clear. 👏
@DataEngUncomplicated
@DataEngUncomplicated 3 жыл бұрын
Thanks a lot!
@mahsaamini8555
@mahsaamini8555 Жыл бұрын
Very useful video, thank you!
@DataEngUncomplicated
@DataEngUncomplicated Жыл бұрын
Thanks Mahsa, I'm glad you found it helpful!
@chritophergaafele8922
@chritophergaafele8922 Жыл бұрын
Thank you very much
@DataEngUncomplicated
@DataEngUncomplicated Жыл бұрын
You're welcome!
@vitorribeirosa
@vitorribeirosa Жыл бұрын
Thanks for sharing this very useful content. Cheers!!!!
@DataEngUncomplicated
@DataEngUncomplicated Жыл бұрын
Thanks Vitor!
@romanvavryk8880
@romanvavryk8880 3 жыл бұрын
Thanks mate, you saved my life
@DataEngUncomplicated
@DataEngUncomplicated 3 жыл бұрын
You're welcome Roman, I'm glad it was helpful.
@revenge9431
@revenge9431 3 жыл бұрын
hello, in your example. What if you wanted to continue with the next 10 rows, how would you write that? If you stop at row 10, rest for 1min then continue to the next ten until complete. thanks
@DataEngUncomplicated
@DataEngUncomplicated 2 жыл бұрын
I think on the read method, there should be a way to limit how many records are read in but I haven't tried this myself.
@mercedehsasanpour5575
@mercedehsasanpour5575 Жыл бұрын
Thank you. One question; how about the situation that I want to add a new column using the data I have in my csv file? for example I have 2 columns in my csv file called open and close. I want to add a new column that shows (close - open)/open I know it should be a code like follow with open('IBM.csv', 'r')as input: with open ('IBM.csv', 'w') as output: writer = csv.writer(output, lineterminator=' ') reader=csv.reader(input) And then I need to use append. but I have no idea now to put all this together and write my final code!
@DataEngUncomplicated
@DataEngUncomplicated Жыл бұрын
You're welcome. Have you used the python library pandas before? If your comfortable working with dataframes, if would be very easy to read the CSV file and then add a new column to it, then write it back to CSV.
@mercedehsasanpour5575
@mercedehsasanpour5575 Жыл бұрын
@@DataEngUncomplicated Thanks, yes it can be done using pandas but I am trying to do it manually. so far I wrote this code: with (open('IBM.csv', newline='', encoding='utf-8') as infile, open('IBM.csv', 'w', newline='', encoding='utf-8') as outfile): reader = csv.DictReader(infile) writer = csv.DictWriter(outfile, fieldnames=['Open', 'Close']) writer.writeheader() for row in reader: #implement this formula (close - open)/open change = ['Close' - 'Open'] / ['Open'] change.append(IBM.csv) print(change.append(IBM.csv)) The first section should be right, but after #implement this formula is not.
@scarletv.3825
@scarletv.3825 Жыл бұрын
I have a question after we pick the column. Is there a way to pick only certain rows within that column? I tried changing the "count." To start from a different number instead of 0 but that didn't work.
@DataEngUncomplicated
@DataEngUncomplicated Жыл бұрын
Do you know the criteria you want to pick your specific rows on? You would need to handle that once your data is in python. I don't think it can be done on read. ( I could be wrong).
@KhalilYasser
@KhalilYasser 3 жыл бұрын
Awesome. Thanks a lot...
@DataEngUncomplicated
@DataEngUncomplicated 3 жыл бұрын
You're welcome!
@teach4944
@teach4944 2 жыл бұрын
Danke!
@DataEngUncomplicated
@DataEngUncomplicated 2 жыл бұрын
Wow thanks for the super thanks Joshua, it is very much appreciated!
@anurathilakbandara3705
@anurathilakbandara3705 2 жыл бұрын
how to find transpose of single column data?
@DataEngUncomplicated
@DataEngUncomplicated 2 жыл бұрын
Hi anura, I discuss this in the second part of the video.
@anurathilakbandara3705
@anurathilakbandara3705 2 жыл бұрын
@@DataEngUncomplicated Thank you very much!
@iamvalenci4
@iamvalenci4 2 жыл бұрын
thank you!!
@DataEngUncomplicated
@DataEngUncomplicated 2 жыл бұрын
You're welcome!
@maxli913
@maxli913 2 жыл бұрын
It’s saying my ‘title’ is not defined
@DataEngUncomplicated
@DataEngUncomplicated 2 жыл бұрын
Hi Max, without much context I'm not sure what this relates to
@maxli913
@maxli913 2 жыл бұрын
@@DataEngUncomplicated hey I’m reading a csv file with movie names, rating, description, genre and etc.. I trying to print out the movie name and descriptions together like this when the user input is (‘P’) ( title : description title: description……) and I am thinking this will help with later when I need to add a Filter
@DataEngUncomplicated
@DataEngUncomplicated 2 жыл бұрын
Sounds like you want to use a python dictionary instead of a python list. Check out my other video that walks through how to get a python dictionary from a csv in python
@maxli913
@maxli913 2 жыл бұрын
@@DataEngUncomplicated oki thank you
@maxli913
@maxli913 2 жыл бұрын
@@DataEngUncomplicated you are such a nice KZbinr btw there aren’t much people like you out there so keep up the good work 😊
@PCAN411
@PCAN411 3 жыл бұрын
Do you know that the audience cannot see what you are talking about because of font size too small?
@DataEngUncomplicated
@DataEngUncomplicated 3 жыл бұрын
Thanks for the heads up, I will make sure my next video uses a larger font. Setting the quality to 1080p will make sure the font is crisp.
Python Pandas Tutorial 4: Read Write Excel CSV File
27:03
codebasics
Рет қаралды 713 М.
Fake watermelon by Secret Vlog
00:16
Secret Vlog
Рет қаралды 27 МЛН
Всё пошло не по плану 😮
00:36
Miracle
Рет қаралды 3,4 МЛН
黑的奸计得逞 #古风
00:24
Black and white double fury
Рет қаралды 26 МЛН
Бенчик, пора купаться! 🛁 #бенчик #арти #симбочка
00:34
Симбочка Пимпочка
Рет қаралды 3,6 МЛН
Python Tutorial: Working with JSON Data using the json Module
20:34
Corey Schafer
Рет қаралды 1,1 МЛН
Python - Accessing Nested Dictionary Keys
24:48
Academind
Рет қаралды 185 М.
Python Tutorial: CSV Module - How to Read, Parse, and Write CSV Files
16:12
Fake watermelon by Secret Vlog
00:16
Secret Vlog
Рет қаралды 27 МЛН