Skip to content

Tag: csv

How to format query results as CSV?

My goal: Automate the operation of executing a query and output the results into a csv. I have been successful in obtaining the query results using Python (this is my first project ever in Python). I am trying to format these results as a csv but am completely lost. It’s basically just creating 2 massiv…

I would like to take a data from in the csv file

this is the equivalent of my csv file; this csv file has 8000 data. I want to separate the “a”, “b”, ,”c”, … “z” in the customer column with the quantity column. this csv file is just an example, actually customers are too many. I don’t know the cust…

Joining two CSV files with common column in Python without Pandas

I wanted to inquire on how I could merge 2 csv files so that I can generate queries. Note that I am not allowed to use the “pandas” library. As an example I have these 2 csv: data.csv: enti.csv: And what I’m looking for is to be able to join them through cod_enti and thus be able to evaluate…

Read, Split and Append csv to lists in python

Problem I need to build a backend function that will read the data within a csv file, split the values and append them to several lists. The program for adding/removing/displaying values form the lists is working but now I need to add file I/O. I have the file inventory.csv and have a function load_file_data(…

Writing Dictionaries into a CSV

I am working on a web scraping project, I am trying to save the results into a CSV file, I want to save the key in the dictionary as columns and the values as a row, (keep in mind that the value pair in the dictionary refers to a variable that extracts data from a web site) Answer Here is

Python – Trouble printing to CSV

My code seems to be outputting the list I want, however, when I try printing the list to CSV I do not get the same result on the .csv file for some reason. I am sure there’s something not right at the end of my code. Could anyone please shed some light? Thanks in advance. Answer I have not used

Python: values written to csv file are in reverse order?

Here is the code in question first: Here is an example output: Why is the csv being written in reverse? The time stamp should be going from 03:23:08 to 03:23:13, but it’s not.. I’m thinking it’s maybe because I’m calling this recursively? But not totally sure. the ‘a’ in th…