One good way to get familiar with how to use a BI (business intelligence) tool such as Tableau is to start with a simple example of a data graphic and then attempt to replicate that graphic using Tableau. In this article I will describe step by step how to create the data display below in … Continue reading Tableau: How to recreate a data graphic found on the web
csv
Python: How to write to a .csv file
Just like reading from .csv files, writing to .csv files also requires importing the csv module. Python: How to open and read .csv documents First define the path and name of your output file, then carefully build your output such that every line you want to write in the .csv file is a list with … Continue reading Python: How to write to a .csv file
Python: How to open and read .csv documents
Unlike text documents, which Python has a native open() function for: Python: How to open and read text documents Opening and reading .csv files requires importing the csv module and using a csv.reader(). For example, this code will open and read the first 10 lines in a .csv file: import csv csv_path = r’C:\Users\Chris\Desktop\Python Scripts\Python … Continue reading Python: How to open and read .csv documents
Pandas: How to export a DataFrame to .csv
Here is a function I wrote that will export an entire DataFrame to csv. It uses the Pandas function to_csv(). Just feed it the name of the DataFrame and the name you want for the .csv file. def dataframe_to_csv(filename, DataFrame): “””Export entire DataFrame to csv.””” output = DataFrame output.to_csv(filename, index=True) The filename can be a … Continue reading Pandas: How to export a DataFrame to .csv