Questions tagged [csvwriter]
58 questions
0
votes
0 answers
How to properly implement openpyxl and csvwriter in AWS with S3 bucket as input directory
I was using this code to process an excel file in Python on my local machine where input_dir was my input directory and file was just the file I wanted to grab from that directory:
input_file = input_dir + file
def excel_to_csv(input_file):
…

hulio_entredas
- 675
- 1
- 12
0
votes
1 answer
TypeError: '_csv.writer' object is not an iterator
I am trying to implement a method in which I can add an item through user input to a row in a csv file.
My file looks like this
enter image description here
With help from a previous question, I was able to implement a solution, but am now getting…

py_coder1019
- 95
- 1
- 8
0
votes
1 answer
How to Add A New Row Into an Existing CSV file with CSV.Writer?
I am trying to implement a method that adds a new row into an existing csv file that I am using for as my "database"
I have the following code so far (a class and some methods left out for simplification):
My Csv File looks like this:
CSV File
class…

py_coder1019
- 95
- 1
- 8
0
votes
0 answers
How can I add items row for row in a csv file
In a csv file, I want to add all unique items to one row and then move to the next row. the names of the (to be filled up) rows are in the header (list), and the items are saved in the dict.
My code looks like this:
if key in dict:
…

law trafalgar
- 1
- 1
0
votes
2 answers
Deleting a row from a CSV based on line number and shifting all lines afterwards
Let's say I have this CSV:
my friend hello, test
ok, no
whatever, test
test test, ok
I want to delete line number 3, so I would call my function:
remove_from_csv(3)
I couldn't find any built-in remove function and I don't want to "write" anything,…

Trigon
- 37
- 5
0
votes
3 answers
How to delete a particular column in csv file without pandas library
I am trying to delete particular columns in csv file.
CSV file:
Name,Age,YearofService,Department,Allocation
Birla,49,12,Welding,Production
Robin,38,10,Molding,Production
I am trying to delete Entire column having column header "Department" and…

Balaji R B
- 3
- 1
- 3
0
votes
2 answers
Write in the next column of CSV file in python
I have a simple code that should write values in two columns, I would like to have the results shown as:
0.48 2.71
But I can only write in rows, how do I write the rows in the second column (I want to have the fines percentages in one column and…

yahya
- 25
- 5
0
votes
1 answer
How do I write csv in memory which I would like to attach to an email?
I have this azure function app that process errors. Before my app exits, I would like to write the errors in our memory as csv and then send the file to a client in an email.This is the code I have that stores file in the disk.
using (var…

PPPP
- 11
- 4
0
votes
1 answer
How to replace double quotes in headers and rows in a CSV file in Java
I'm new to Java. I have the following CSV file located in my local folder: C:\Users\MyFile\myFile.csv. The first line of the file is the header. I would like to replace the double quotes from headers and values in the file and replace the file in…

ychaulagain
- 73
- 1
- 8
0
votes
1 answer
how to prevent the writerow method to iterate through a string
I want to write a string to a csv using writerow but the result I'm getting is not what i want
def date_csv():
date_str = pd.Timestamp.today().strftime('%d-%m-%Y')
print(date_str) ### output: 16-04-2022
with open("Alert_date.csv",…

Chebbi Hamza
- 3
- 1
0
votes
1 answer
Issue with CSV reopening after appending data to it in Python
I have this working button and it does save, but my issue is I can start my tkinter program again from the same file. It works and if need more can share it, but the loop is where split from the csv for my columns in tkinter. Just can't get my…

alex b
- 3
- 1
0
votes
1 answer
How to remove quotation and parenthesis around csvwriter output
I have a gps sensor that outputs latitude and longitude. Along with it I am calling the current time in timec(). I want to output these values into a text file that I can upload into excel for extrapolation.
My outputs currently look…

colem
- 15
- 4
0
votes
1 answer
Writing to a CSV file with only one header line
I'm currently working with several files and want to write to a csv. I open them all up in a for loop and do calculations based on information in the files. I want to write all this data to a single csv file.
I have this code within my for…

matrix_season
- 159
- 8
0
votes
1 answer
numpy matrix row to csv
in the code below, my intention is to copy the rows of this matrix to a csv file. I know that the csv function writer copies an array perfectly. But when the row comes from a matrix this doesn't seem to work. The csv file then looks like this…

LiDeb
- 23
- 4
0
votes
1 answer
Saving and adding a new line to a csv file with TKinter in Python
SO I've included some of my code having trouble capturing data from the entry fields in TKinter and having them overwrite a csv file. It will overwrite the csv file, but not add a new line at the end of the file like want.
#Variables
File =…

alex b
- 3
- 1