Skip to content

Instantly share code, notes, and snippets.

Created May 28, 2016 13:33
Show Gist options
  • Save anonymous/eabd8c69fb048e8d3f53b8a5acc7ac7a to your computer and use it in GitHub Desktop.
Save anonymous/eabd8c69fb048e8d3f53b8a5acc7ac7a to your computer and use it in GitHub Desktop.
import pandas as pd
import os
file = os.path.abspath('C:\\Zerodha\\Pi\\Exported\\Nifty 50.csv')
df = pd.read_csv(file)
df['Date'] = pd.to_datetime(df['Date'], format = '%d/%m/%y %I:%M:%S %p')
df['Time'] = df['Date'].apply(lambda x: x.strftime('%H:%M'))
df['Date'] = df['Date'].apply(lambda x: x.strftime('%y-%m-%d'))
df.set_index('Date', drop=True, inplace=True)
df.columns = ['O', 'H', 'L', 'C', 'V', 'Time']
df.to_csv('Nifty 50.csv')
@partha0dhar
Copy link

how to do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment