Created
February 14, 2018 09:23
-
-
Save SBNBON005/703c9e69081ab7176a3048072bbdea4d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import matplotlib.pyplot as plt | |
# Assuming following csv format | |
# | |
# time | Column_Name1 | Column_Name2 | |
# -------------------------------------------- | |
# 2017-02-31 12:00:00 | 1.05597 | 1.05557 | |
# 2017-02-30 16:02:00 | 1.05560 | 1.05558 | |
# | |
# read csv data into pandas dataframe and use time column as an index | |
df = pd.read_csv('/path/to/file.csv', index_col='time', parse_dates=True) | |
df['Column_Name'] # accessing a column | |
# ploting a column | |
df['Column_Name1'].plot() # Or df.plot(y='Column_Name1') | |
plt.show() | |
# plotting a column vs time | |
df.plot(x='time', y='Column_Name2') | |
plt.show() | |
# plotting all columns vs time | |
df.plot(x='time') | |
plt.show() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment