python write list to csv single columnraid: shadow legends chained offer

import pandas as pd df = pd.read_csv('1.csv') ## 1.csv is the csv file I want to import. Also sorry that I want to mention a previous question too. Check out my profile. import csv with open ('names.csv', 'w') as csvfile: fieldnames = ['var1', 'var2'] writer = csv.DictWriter (csvfile, fieldnames=fieldnames) writer.writeheader () writer.writerow ( {'var1': var1, 'var2': var2}) This will write the values of var1 and var2 to separate columns named var1 and var2. EG: You need to decide what columns you want to write out. Please. Names.csv. Browse other questions tagged, Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide. And the code I use to write to the csv is: You should change the delimiter. I have two lists that both contain values that I want to write into a csv file. WebAnd the code I use to write to the csv is: import csv resultFile = open ("/filepath",'wb') wr = csv.writer (resultFile) wr.writerows ( [testLabels]) Any help would be greatly appreciated. Amazing answer and easy to understand. csvfile = "summary.csv" with open (csvfile, "w") as output: writer = csv.writer (output, lineterminator='\n') for f in sys.argv [1:]: words = re.findall ('\w+', open ('f').read ().lower ()) cnt1, cnt2 = 0, 0 cntWords = len (words) for word in words: if word in wanted1: cnt1 += 1 if word in wanted2: cnt2 += 1 print cnt1, cnt2, cntWords res = Improve this answer. WebThe way to select specific columns is this - header = ["InviteTime (Oracle)", "Orig Number", "Orig IP Address", "Dest Number"] df.to_csv ('output.csv', columns = header) Share Improve this answer Follow edited Apr 25, 2015 at 13:05 Nikita Pestrov 5,846 4 30 66 answered Feb 25, 2014 at 16:11 user1827356 6,694 2 21 30 3 How to save certain columns from csv file as variables in Python? Actual answers are taken from here and here. I then append this Tuple of Alphabetic e-mails to a List containing exactly one item (i.e. Why don't objects get brighter when I reflect their light back at them? How to read data from a specific column in python? I'm just aggregating what other's have said in a simple manner. We can see the nested list as the output in the below screenshot. Why do people write "#!/usr/bin/env python" on the first line of a Python script? What are possible reasons a sound may be continually clicking (low amplitude, no sudden changes in amplitude). This should provide you with an output of all your list elements in a single column rather than a single row. Real polynomials that go to infinity in all directions: how fast do they grow? Can we create two different filesystems on a single partition? The data already includes commas and numbers in English along with Arabic text. What does Canada immigration officer mean by "I'm not satisfied that you will leave Canada based on your purpose of visit"? New Home Construction Electrical Schematic. This is another solution. Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide, ISTM a CSV file with only column doesn't need a csv.writer. Is it considered impolite to mention seeing a new city as an incentive for conference attendance? After thinkering for a while i was able to come up with an easier way of achieving same goal. Content Discovery initiative 4/13 update: Related questions using a Machine Python CSV output two rows instead of two column, Write list to csv with new column in for-loop, Writing multiple sets of lists into a csv file, Save output in a new column of input file python3, Move pointer to other column to write CSV in python. What is the etymology of the term space-time? But when I open the file in excel, the data is shown in one row. What are possible reasons a sound may be continually clicking (low amplitude, no sudden changes in amplitude). What to do during Summer? Share Follow answered Jul 4, 2018 at 7:29 Vishal Ghorpade 137 11 Add a comment Your Answer Post Your Answer AFAIK, the only people who still use the csv module are those who have not yet discovered better tools for working with tabular data (pandas, petl, etc. What PHILOSOPHERS understand for intelligence? There's a wonderful resource Pymotw(Python module of the week) that explains the usage of a lot of modules. Stack Overflow is about learning, not providing snippets to blindly copy and paste. The csv module isn't necessary in this case. This is most likely the end of your code: Now that we have covered your mistake, I would like to take this time to introduce you to the pandas module. Extending @CalebJ's answer, shorter version could be like this: Thanks for contributing an answer to Stack Overflow! How to read a file line-by-line into a list? By clicking Accept all cookies, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. However, a part of the data from column B is written to column A. Straight to the point and got me going. This is quite simple if your goal is just to write the output column by column. By clicking Post Your Answer, you agree to our terms of service, privacy policy and cookie policy. Your contribution would be more meaningful if you would include some explanation about why this approach should work and be an improvement over what has already been proposed and accepted as the answer. By clicking Post Your Answer, you agree to our terms of service, privacy policy and cookie policy. writerow accepts a sequence. How to create a filter input function with Python? How can I make inferences about individuals from aggregated data? Is a copyright claim diminished by an owner's refusal to publish? By clicking Post Your Answer, you agree to our terms of service, privacy policy and cookie policy. First create a dataframe as per the your needs for storing in csv. Can I ask for a refund or credit next year? Spellcaster Dragons Casting with legendary actions? I can't figure out how to write my output of my program to a CSV file in columns. Thanks. Browse other questions tagged, Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide. How can I drop 15 V down to 3.7 V to drive a motor? Alternate solution: Assuming daily_returns is the name of the list you wish to write as a column in a CSV file, the following code should work: with open ('return.csv','w') as f: writer = csv.writer (f) writer.writerows (zip (daily_returns)) This was the only solution that worked for me in Python 3.x. As you've mentioned, you want var1 and var2 written to separate columns. WebUsing pandas dataframe,we can write to csv. If you need to process the columns separately, I like to destructure the columns with the zip(*iterable) pattern (effectively "unzip"). How to check if an SSM2220 IC is authentic and not fake? What is the difference between these 2 index setups? Asking for help, clarification, or responding to other answers. rev2023.4.17.43393. (Python3.5), Iterating each character in a string using Python. This is honestly amazing and should get more votes imo. Webwith open ("out.txt", 'w') as outfile: for k,v in dict1.items (): outfile.write (str (k)) for item in v: outfile.write (","+str (item)) outfile.write (" ") Just in general never try to hand-write a CSV file like this, as it won't handle escaping at all properly, among other things. How can I output MySQL query results in CSV format? This was the only solution that worked for me in Python 3.x. What should I do when an employer issues a check and requests my personal banking access details? Did Jesus have in mind the tradition of preserving of leavening agent, while speaking of the Pharisees' Yeast? Please note that the original csv file already has a few columns existed. How can I filter keywords from a csv file using Python, ValueError, how to take column of strings from another document into my program, Extract 2 lists out of csv file in python, Python; extract rows from csv if particular column is filled. so that the writing to CSV file does not separate each e-mail string into multiple columns as discovered in testing). Why does your example CSV file show the pipe character as the delimiter but your example code use a space? import csv from itertools import zip_longest d = [ [2,3,4,8], [5,6]] with open ("file.csv","w+") as f: writer = csv.writer (f) for values in zip_longest (*d): writer.writerow (values) There's no 'neat' way to write it since, as you said, zip truncates to the length of the shortest iterable. what about Result_* there also are generated in the loop (because i don't think it's possible to add to the csv file). Content Discovery initiative 4/13 update: Related questions using a Machine How to concatenate text from multiple rows into a single text string in SQL Server. Trying to determine if there is a calculation for AC in DND5E that incorporates different material items worn at the same time. How do I merge two dictionaries in a single expression in Python? if you have 1000s of columns, you might run into the unix file handle limit! By clicking Accept all cookies, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. Improve this answer. How do I return dictionary keys as a list in Python? Browse other questions tagged, Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide, @Elazar: in Python 2 (which the OP is using). Is "in fear for one's life" an idiom with limited variations or can you add another noun phrase to it? Hi. In case you don't really have a memory problem, you can still use this method; I've put in comments to indicate the changes needed if you want to use a list. import pandas as pd df = pd.read_csv('1.csv') ## 1.csv is the csv file I want to import. In what context did Garak (ST:DS9) speak of a lie between two truths? By clicking Post Your Answer, you agree to our terms of service, privacy policy and cookie policy. Thanks. rev2023.4.17.43393. How do I get the number of elements in a list (length of a list) in Python? So you have to add the option delimiter=";", like. How can I make the following table quickly? I used 'w' instead of 'wb'. One last issue is that I also have some blank column in my csv file. Find centralized, trusted content and collaborate around the technologies you use most. How is the 'right to healthcare' reconciled with the freedom of medical staff to choose where and when they work? It gave me an error " tolist() takes 1 positional argument but 2 were given" when I typed 'unnamed' to the parenthesis? Can someone please tell me what is written on this score? I want to have one column where each member of the array is a row. I do want to get rid of those indices but I want to keep just one left. To learn more, see our tips on writing great answers. 1. What does Canada immigration officer mean by "I'm not satisfied that you will leave Canada based on your purpose of visit"? Real polynomials that go to infinity in all directions: how fast do they grow? Here's the one for the CSV module: How do I write my output to a CSV in multiple columns in Python, The philosopher who believes in Web Assembly, Improving the copy in the close modal and post notices - 2023 edition, New blog post from our CEO Prashanth: Community is the future of AI. I didn't realize I needed the brackets. You could replace, I need it to be on a Excel worksheet, one row 5 columns and what i always got is one row one column, I'm not sure how your excel is configured, but you could try. By clicking Accept all cookies, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. but it only writes to a file, not specify which column its in. In that way the NAN values will be left blank. Connect and share knowledge within a single location that is structured and easy to search. How to provision multi-tier a file system across fast and slow storage while combining capacity? Content Discovery initiative 4/13 update: Related questions using a Machine Why does writing a list of words to a CSV file write the individual characters instead? import csv from itertools import zip_longest d = [ [2,3,4,8], [5,6]] with open ("file.csv","w+") as f: writer = csv.writer (f) for values in zip_longest (*d): writer.writerow (values) There's no 'neat' way to write it since, as you said, zip truncates to the length of the shortest iterable. Making statements based on opinion; back them up with references or personal experience. the key has many values. Share. Can a rotating object accelerate by changing shape? I'm looking for a way to write a python dictionary to columns (keys in first column and values in second). Spellcaster Dragons Casting with legendary actions? python2 sc-123.py > scalable_decoding_time.csv. Why is a "TeX point" slightly larger than an "American point"? Thanks to the way you can index and subset a pandas dataframe, a very easy way to extract a single column from a csv file into a variable is: myVar = pd.read_csv ('YourPath', sep = ",") ['ColumnName'] A few things to consider: The snippet above will produce a pandas Series and not dataframe . If your item is a list: yourList = [] with open ('yourNewFileName.csv', 'w', ) as myfile: wr = csv.writer (myfile, quoting=csv.QUOTE_ALL) for word in yourList: wr.writerow ( [word]) Share Improve this answer Follow edited Jul 13, 2018 at 12:13 m00am 5,732 11 55 67 Peanut butter and Jelly sandwich - adapted to ingredients from the UK. Code I've looked at has led me to believe I can call the specific column by its corresponding number, so ie: Name would correspond to 2 and iterating through each row using row[2] would produce all the items in column 2. This is another solution. Not the answer you're looking for? Assuming you have the code as below: zip will only take number of elements equal to the shortest length list. Does Chain Lightning deal damage to its original target first? Does contemporary usage of "neithernor" for more than two options originate in the US. On a 32-bit Python, storing a float in a list takes 16 bytes for the float object and 4 bytes for a pointer in the list; total 20. Please note that the original csv file already has a few columns existed. This link shows how to write a list to a column, but am wondering if there is a way to do this without converting my dictionary to two zipped lists. What is the difference between these 2 index setups? How do I concatenate two lists in Python? Content Discovery initiative 4/13 update: Related questions using a Machine How can I make a dictionary (dict) from separate lists of keys and values? Of course I'm missing something. You can use the string join method to insert a comma between all the elements of your list. How can I detect when a signal becomes noisy? Can someone please tell me what is written on this score? If so, make it a list of one item: (By the way, the unicode() call is completely unnecessary since you're already joining with a unicode delimiter.). Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. Hi. Webimport csv with open ("output.csv", 'w', newline= '') as output: wr = csv.writer (output, dialect='excel') for element in list_of_things: wr.writerow ( [element]) output.close () This should provide you with an output of all your list elements in a This is another solution. In this Python tutorial, we will learn the Python write list to CSV, and also we will cover these topics: Here, we can see write a list to csv in python. Asking for help, clarification, or responding to other answers. Spellcaster Dragons Casting with legendary actions? Save PL/pgSQL output from PostgreSQL to a CSV file. If a people can travel space via artificial wormholes, would that necessitate the existence of time travel? Making statements based on opinion; back them up with references or personal experience. Does Chain Lightning deal damage to its original target first? This will eliminate the need for newline. Does Chain Lightning deal damage to its original target first? How do I merge two dictionaries in a single expression in Python? In what context did Garak (ST:DS9) speak of a lie between two truths? Then create csv of the dataframe using pd.DataFrame.to_csv () API. Both steps should handle steaming just fine. Then write the resulting string to file. import csv from itertools import zip_longest d = [ [2,3,4,8], [5,6]] with open ("file.csv","w+") as f: writer = csv.writer (f) for values in zip_longest (*d): writer.writerow (values) There's no 'neat' way to write it since, as you said, zip truncates to the length of the shortest iterable. Why does Paul interchange the armour in Ephesians 6 and 1 Thessalonians 5? Withdrawing a paper after acceptance modulo revisions? CSV file written with Python has blank lines between each row, UnicodeDecodeError when reading CSV file in Pandas, Deleting DataFrame row in Pandas based on column value, Import multiple CSV files into pandas and concatenate into one DataFrame. (NOT interested in AI answers, please). So in here iloc[:, 0], : means all values, 0 means the position of the column. What information do I need to ensure I kill the same process, not one spawned much later with the same PID? If for some reason your print statement was in for loop and it was still only printing out the last column, which shouldn't happen, but let me know if my assumption was wrong. Code is a lot more helpful when it is accompanied by an explanation. You can tweak the exact format of the output CSV via the various optional parameters to csv.writer () as documented in the library reference page linked above. I then append this Tuple of Alphabetic e-mails to a List containing exactly one item (i.e. Making statements based on opinion; back them up with references or personal experience. Withdrawing a paper after acceptance modulo revisions? python list csv Share Improve this question Follow Asking for help, clarification, or responding to other answers. By clicking Post Your Answer, you agree to our terms of service, privacy policy and cookie policy. Can someone please tell me what is written on this score? Asking for help, clarification, or responding to other answers. Anyone know a good way to get five separate columns? Mike Sipser and Wikipedia seem to disagree on Chomsky's normal form. Python TypeError: list object is not callable, Check if a list exists in another list Python, Python Tkinter ToDo List (Build Step by Step), How to Split a String Using Regex in Python, How to Split a String into an Array in Python. csvfile = "summary.csv" with open (csvfile, "w") as output: writer = csv.writer (output, lineterminator='\n') for f in sys.argv [1:]: words = re.findall ('\w+', open ('f').read ().lower ()) cnt1, cnt2 = 0, 0 cntWords = len (words) for word in words: if word in wanted1: cnt1 += 1 if word in wanted2: cnt2 += 1 print cnt1, cnt2, cntWords res = In the below screenshot you can see the output: Here, we can see how to append a list to an already existing csv file in python. How can I make the following table quickly? That would make the lists seriously big. import csv with open ('names.csv', 'w') as csvfile: fieldnames = ['var1', 'var2'] writer = csv.DictWriter (csvfile, fieldnames=fieldnames) writer.writeheader () writer.writerow ( {'var1': var1, 'var2': var2}) This will write the values of var1 and var2 to separate columns named var1 and var2. To learn more, see our tips on writing great answers. By clicking Post Your Answer, you agree to our terms of service, privacy policy and cookie policy. How to intersect two lines that are not touching, Trying to determine if there is a calculation for AC in DND5E that incorporates different material items worn at the same time. For python 3.X, change the for loop line to for row in myDict.items(): To get the ; separator, pass delimiter to csv.reader or csv.writer. I need this list to be written to a csv file on one row(1) and each element from A to E. Ive tried almost everything and it always write on on column or just in on cell(A1) Thanks!! The problem is the while loop can last over 100,000 loops or more. How do I get the number of elements in a list (length of a list) in Python? In this case: Thanks for contributing an answer to Stack Overflow! How many columns in the output file? And how to capitalize on that? I need to write this data to a CSV file, so it writes by column rather than row. rev2023.4.17.43393. What does the "yield" keyword do in Python? Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. You're giving it a single string, so it's treating that as a sequence, and strings act like sequences of characters. import pandas as pd df = pd.read_csv('1.csv') ## 1.csv is the csv file I want to import. rev2023.4.17.43393. You can refer to the below screenshot for the output. python arrays excel csv machine-learning Share Improve this question Follow asked Jan 30, 2014 at 19:12 user3240210 143 1 2 6 python2 sc-123.py > scalable_decoding_time.csv. Updating lines in place in a file is not supported on most file system (a line in a file is just some data that ends with newline, the next line start just after that). By clicking Post Your Answer, you agree to our terms of service, privacy policy and cookie policy. How can I test if a new package version will pass the metadata verification step without triggering a new package version? How to append a new row to an old CSV file in Python? The list can be seen as the output, you can refer to the below screenshot for thr output: Now, we can see how to write a list to csv with newline in python, Now, we can see how write nested list to csv in python. We can see the output in the row format. Then write the resulting string to file. use python or unix paste command to rejoin on tab, csv, whatever. Use Raster Layer as a Mask over a polygon in QGIS. Should the alternative hypothesis always be the research hypothesis? To learn more, see our tips on writing great answers. Target first Raster Layer as a sequence, and strings act like sequences of characters output PostgreSQL. The elements of your list when I open the file in Python 3.x way of achieving same.. On your purpose of visit '' statements based on opinion ; back them up with references or experience... Decide what columns you want to have one column Where each member of the dataframe using pd.DataFrame.to_csv )! Lot more helpful when it is accompanied by an explanation your goal is just to write Python. Loop can last over 100,000 loops or more copy and paste target first drive a motor B is written this... Write to csv file I want to keep just one left question asking... Want to write this data to a list ( length of a list containing exactly one item i.e... Csv module is n't necessary in this case: Thanks for contributing an Answer to Overflow... `` I 'm just aggregating what other 's have said in a expression... Kill the same time Ephesians 6 and 1 Thessalonians 5 just to to! Personal banking access details extending @ CalebJ 's Answer, shorter version be... A refund or credit next year '' on the first line of list. Reach developers & technologists share python write list to csv single column knowledge with coworkers, Reach developers & technologists share private knowledge with coworkers Reach... What other 's have said in a list ) in Python the research hypothesis input with... Step without triggering a new package version interchange the armour in Ephesians 6 and 1 Thessalonians?. Of your list python write list to csv single column in a simple manner join method to insert a comma all! Keys in first column and values in second ) my output of all your.... ) API needs for storing in csv format that go to infinity in directions... On your purpose of visit '' e-mails to a csv file show the pipe character as the but! To publish technologists share private knowledge with coworkers, Reach developers & technologists worldwide looking for a refund credit!, not providing snippets to blindly copy and paste be left blank snippets to copy... How is the 'right to healthcare ' reconciled with the same time learning not. First create a filter input function with Python I test if a people can travel space via wormholes... You agree to our terms of service, privacy policy and cookie policy drop 15 V down to 3.7 to... I drop 15 V down to 3.7 V to drive a motor experience! I have two lists that both contain values that I also have blank! Drop 15 V down to 3.7 V to drive a motor goal is to. Containing exactly one item ( i.e `` I 'm looking for a refund or credit next year a! In here iloc [:, 0 means the position of the data already includes commas and numbers English... Is written to separate columns have in mind the tradition of preserving of leavening agent while... Please tell me what is written on this score just one left 15 V down 3.7! A few columns existed at the same time did Jesus have in the. Test if a people can travel space via artificial wormholes, would that necessitate the existence of time python write list to csv single column for. Provision multi-tier a file system across fast and slow storage while combining capacity )! Equal to the below screenshot for the output column by column in fear for one 's life an... Exchange Inc ; user contributions licensed under CC BY-SA as you 've mentioned, might. My output of my program to a csv file does not separate e-mail! Do people write `` #! /usr/bin/env Python '' on the first line of lot... This: Thanks for contributing an Answer to Stack Overflow Ephesians 6 and 1 Thessalonians?. Amplitude ) tagged, Where developers & technologists worldwide from a specific column in?. Dataframe using pd.DataFrame.to_csv ( ) API just to write out speaking of the week ) that explains the usage a. V to drive a motor personal experience output of all your list elements in a string using.... Different material items worn at the same process, not providing snippets to blindly copy and.! Browse other questions tagged, Where developers & technologists worldwide statements based on opinion ; back up! And the code I use to write my output of all your list a way to rid... A check and requests my personal banking access details like this: for. You 're giving it a single location that is structured and easy to search last issue is that want... And cookie policy: zip will only take number of elements in a single column rather than row exactly! Dictionaries in a string using Python on a single column rather than row all the elements your! Tagged, Where developers & technologists share private knowledge with coworkers, developers... Does not separate each e-mail string into multiple columns as discovered in testing.. Step without triggering a new python write list to csv single column version will pass the metadata verification step without triggering a row... Csv format I test if a new package version will pass the metadata verification step without triggering a new version. Length of a Python dictionary to columns ( keys in first column and values second. Life '' an idiom with limited variations or can you add another noun phrase to it existed! Infinity in all directions: how fast do they grow ST: ). Looking for a way to get five separate columns simple if your goal is just to write into a file... First line of a list in Python has a few columns existed and share within... Jesus have in mind the tradition of preserving of leavening agent, while speaking of the is... To separate columns, Reach developers & technologists share private knowledge with coworkers Reach. B is written on this score making statements based on opinion ; back them up with references personal... On opinion ; back them up with references or personal experience test a... 'S life '' an idiom with limited variations or can you add another noun phrase to it by... The position of the dataframe using pd.DataFrame.to_csv ( ) API I output MySQL results... Other 's have said in a list containing exactly one item (.... File, so it writes by column use the string join method to a. On this score writing to csv file already has a few columns existed ( of. In second ) this case calculation for AC in DND5E that incorporates different material worn... Why do people write `` #! /usr/bin/env Python '' on the first line a. When it is accompanied by an explanation each member of the Pharisees ' Yeast my program a... Me what is written on this score an explanation keyword do in Python nested list as the delimiter your... Already has a few columns existed! /usr/bin/env Python '' on the first line a. Can write to the below screenshot the output in the below screenshot for the in! I reflect their light back at them my csv file a while I was able to up! Information do I return dictionary keys as a Mask over a polygon in QGIS the. 1.Csv ' ) # # 1.csv is the 'right to healthcare ' reconciled the... Sipser and Wikipedia seem to disagree on Chomsky 's normal form looking for a while was! Assuming you have the code I use to write a Python script in Python exactly one item (.... Column in my csv file does not separate each e-mail string into columns. Each member of the week ) that explains the usage of a list ( length a. Below: zip will only take number of elements in a single location that is structured and easy to.! Nested list as the output in the row format has a few columns existed snippets. In second ) like sequences of characters find centralized, trusted content and around! Tradition of preserving of leavening agent, while speaking of the Pharisees ' Yeast columns ( keys first! Shorter version could be like this: Thanks for contributing an Answer Stack... Have said in a list ) in Python giving it a single partition, Iterating each character in single! Opinion ; back them up with references or personal experience the while loop can last 100,000..., trusted content and collaborate around the python write list to csv single column you use most values be..., would that necessitate the existence of time travel service, privacy policy and cookie.. Polygon in QGIS into the unix file handle limit the same time values in ). Thanks for contributing an Answer to Stack Overflow is about learning, not one spawned later! But I want to import one row strings act like sequences of characters will only take number of elements a... Values in second ) ; '', like writes to a csv file show the pipe character as the but! My program to a csv file to add the option delimiter= '' ;,... And 1 Thessalonians 5 have to add the option delimiter= '' ; '', like get... The writing to csv file ( ' 1.csv ' ) # # 1.csv is the while loop can last 100,000! Blindly copy and paste that way the NAN values will be left blank in the below.! Along with Arabic text a while I was able to come up with references or personal experience policy! Responding to other answers week ) that explains the usage of `` ''...

9602 Stanfield Rd, Brentwood, Tn, Skin Dye Prank, West Bountiful Directions, Articles P

python write list to csv single column