Read and Write Data in python

This post shows how to import data to Python from numerous resources

CSV File

Read a csv file from local or from a server

import numpy as np
import pandas as pd
# read data
df = pd.read_csv('data.csv', header = 0)
# write data
df.to_csv('data.csv', header=1, index=False)
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s