Questions tagged [csvwriter]
58 questions
0
votes
1 answer
Python - Dictionary list writing to CSV as string, not list - cannot parse into pandas later on
for k,v in groupDict_sanitized.items():
if discovered_hosts_groupid in v:
csvdata = (k,v)
print(k,v)
print(type(v))
#Example from print output
#20099 ['5']
#
#20100…

NOC_NOC
- 13
- 1
0
votes
1 answer
python program to generate a csv file where each column is a data of sinusoidal wave
The requirement is to generate a csv file where each column is a data of sinusoidal wave of frequency 1 Hz,2 Hz, 3Hz, 4Hz, 5Hz, 6Hz, 7Hz. Thus total 7 columns.
100 wave points for 1Hertz and thus total 100 x 7= 700 points.
Can anyone explain how to…

Uday
- 57
- 12
0
votes
1 answer
python csvwriter outputs strings on seperate rows instead of being on the same row
Been a while and i'm getting back into coding for a research project, i'm currently doing a practice site to see what I need to do for the actual site.
I've got everything working how I want, but when the scraped data is outputted to csv it puts the…

nm1999
- 35
- 6
0
votes
1 answer
when does CSVWriter throws exception when csvWriter.close()?
I am trying to cover a Unit test case for an Exception.
my code looks like this
if (null != csvWriter) {
try {
csvWriter.close();
} catch (Exception ee) {
log.error("Error in closing csvWriter. You may loose…

kisame
- 11
- 5
0
votes
1 answer
How to rewrite only one field (line[n]) in csv but in same time be able to work with data?
I have a csv file with three lines and three columns here.
This is the csv file
At first I want to print all the lines.
Subsequently, for each of them, program check whether it is written in the second field(index 1) USA. If so, program will take…

Mirek6
- 25
- 8
0
votes
3 answers
How to rewrite only one frame (line[2]) in line in .csv file?
I would like to rewrite value in csv file only in third frame for every line.
First two frames would be same.
But in output of this code is
builtins.TypeError: '_csv.writer' object is not iterable
import csv
with open('friends.csv', mode='w') as…

Mirek6
- 25
- 8
0
votes
1 answer
Is there a specific method for printing 3 different files paths to a csv after iterating through a folder?
I'm still pretty new to python and trying my best to teach myself. What I'm trying to do is get 3 different file paths written to a csv after iterating through a folder. I'm having an issue in that only the first file path that should print is…

mercurial_app
- 3
- 1
0
votes
1 answer
Using CSVWriter to write a string array - some with quotes and some without
I see some other questions about CSVWriter writing to files and quotes. But nothing as specific as my issue.
I want to print something like:
abc,def,ghi,"jkl",mno,pqr
When I just write:
CSVWriter writer = new CSVWriter(new…

ssn
- 2,631
- 4
- 24
- 28
-1
votes
1 answer
Cannot join chars into string in csv writer
I want to save my result into csv file. This is my code:
import itertools
import csv
letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
combinations = list(itertools.permutations(letters, 4))
print(len(combinations))
with open('result.csv', 'w', newline='')…

Alfian Khusnul
- 30
- 4
-1
votes
1 answer
Beautifulsoup/Writer returns an empty cell when exported to a CSV
I'm scraping a website to get the name, birth + death dates, and the name of the cemetery someone is buried in. For the most part, it is working quite well; however, when I exported the text to a CSV, I noticed that there's a blank cell inserted in…

Sanderson10453
- 5
- 2
-1
votes
1 answer
Writing list into csv
row=[]
for row in Final_20:
Query="select * from table where value='"+value+"'"
c.execute(Query)
rows.append(c.fetchall())
with open(CSVFilename, 'w+',newline='') as file:
writer = csv.writer(file,…

S SUBHASH
- 1
- 4
-1
votes
1 answer
Last 52 lines are not written in csv file using qt
I have one csv file in which 3 column and 866300 lines. I have try to write this data into other csv file. when i try to write it has write 866248 lines in file after that remaining 52 lines are not write in file. what is the problem I do not…

coder
- 52
- 1
- 6
-2
votes
1 answer
Some CSV values appear in the wrong column (with open python)
I'm writing data to a CSV file in Python. The data is in Unicode-8. I've written several rows successfully. However, a part of the data from column B is written to column A. The data already includes commas and numbers in English along with Arabic…

Esraa Abdelmaksoud
- 1,307
- 12
- 25