Skip to content

Tag: csv

Converting a CSV column into a 1D list and then into a 2D list

Hope you are well, I am fairly new in the python world and the coding world in general. I wanted to test python/panda’s powers and the usefulness of making lists. I have a column called ‘Lines’ in my csv file which reads like this: Lines A,B,C A,D,C B,C,D,E A,B,C,D,E C C,D,E Which I converted to a 1D list (thanks to

Defining path for downloaded CSV file in python3

I’m successfully able to download CSV files from a folder on Exavault, using the files provided by Exavault, but the download gets saved in a temporary folder on my Mac. How do I define the directory to save it to? This is an excerpt of the script. Separately there’s a file, which might hold the answer, but if I

Replacing Double Quotes of Specific Column Entries in CSV File?

I have a huge CSV file with sample data that looks like so: The original CVS file had some unnecessary characters that I removed to obtain the data as shown above using the following code: Where I’m stuck now is, how do I replace the double quotes (“”) with single quotes (“) for all the entries of the field column

Python script to extract data from csv file

sharing the sample file screenshots, script I developed and other details below. In the countries_source.csv file, I have a list of countries and I need a subset of its data created in mycountries.csv file until I hit the value “Asia” in the first column. Using the below script, I was able to get the data till the 14th row –

Python iterate folder of csv and convert do json

I am amateur at python but I have a task of converting folder of csv to json files. I have this script working with specified CSV file but I have no idea how to make the script iterate thrue folder of csv and convert all of those csv to json. The original script: someone will give me a hint? Answer