All Questions
1,161 questions
0
votes
2
answers
1k
views
Convert multiple .txt files to .csv files
I have multiple .txt files and I want to convert them to .csv files with the same name. The filename for these .txt files is something like this:
01-09-2022-something.txt
02-09-2022-something.txt
03-...
0
votes
1
answer
105
views
Write a list of lists into csv and having UnicodeEncodeError in python
I am converting an xlsm file to csv using the openpyxl library.
I have the problem that when I try to pass the list of lists to the csv python returns the following error:
Traceback (most recent call ...
1
vote
2
answers
278
views
Saving data in excel by cell rather than semi-colon with python
***Edit: I am originally saving the code to a .csv file but then later converting it to a .xlsx file.
I am trying to change my code to save the values in separate cells verses in the same cell ...
0
votes
0
answers
34
views
Interpret CSV with equal delimiter values in Python 2.7
I need to create the following solution, I have a CSV file that the delimiter is a comma (,), but in one of the columns this comma can come by error in the user registration. The CSV scenario is this:
...
2
votes
3
answers
781
views
Zipping a list of folders with Python
everyone. I'm really new to Python, so I need some help here.
I have a list of folders names inside a .CSV file. All these folders are inside the same path.
I need to zip them individually (each one ...
0
votes
0
answers
94
views
How to load certain portion of file into memory and write it on a file in Python?
I have a csv file which generates dataframe for every second and stores it in it. It will have millions of values. How to load only certain part. Like only first 5 MB. Then next 5 MB in a text file.. ...
0
votes
1
answer
444
views
Compare 2 csv files and check for first 2 columns, if it matches ask the user to decide to override or not and then proceed to next row
I have a use case where I have 2 CSV files with some rows in each CSV file, and they have three columns each. Compare the 2 csv files for first 2 columns and if it matches then ask the user input if ...
0
votes
1
answer
31
views
Please help me out with translating this Python code [duplicate]
Please help with translate this Python code
I am trying to figure out the meaning of this code and could not end up with a conclusion... does anybody know how this single line code is like when it is ...
0
votes
1
answer
582
views
Add random noise in each value of CSV rows
I am trying to add some random noise to my csv columns except last column.
This is my csv file:
z-1 z-2 z-3 z-4 z-5 z-6 z-7 class
0.1305512 0....
0
votes
0
answers
74
views
Python read csv file
Help me! This is the error message
UnicodeDecodeError
Traceback (most recent call last)
<ipython-input-8-6e197d6c2788> in <module>()
2 csv_reader = csv.reader(f)
3
----> ...
0
votes
1
answer
752
views
How to insert values based on condition in column in the CSV file using Python?
I want to insert values from the list based on the condition,
For example, Please find below my algorithm of the code using CSV module.
out_file = open("c://Project//in.csv", "w")
...
1
vote
2
answers
546
views
Replace xml value based on csv columns
I am trying to replace class name in xml file based on csv columns. Actually xml files are annotation files.
This is the format of xml:
<annotation>
<folder>./test_xmls</folder>
<...
0
votes
1
answer
110
views
How can i query csv file and update a value
I'm working with python 2.7 and basically my python script consist of opening a csv file, looping into the rows to find the one with the id the user entered. Once the row is found, depending on some ...
1
vote
1
answer
1k
views
Python - CSV rows into multiple lists
I want to convert each of the rows in my csv file into lists. But the below code doesn't work , it rather converts all the columns into lists
def data():
import csv
f=open("mydata.csv",&...
0
votes
1
answer
572
views
converting a multiple space delimited file to CSV using python 2.7 with Pandas?
I have multiple problems that I'm trying to solve with this single file, but but my immediate concern is trying to convert this file which has fields which are delimited by variable numbers of white ...