Skip to content

Instantly share code, notes, and snippets.


Created May 28, 2016
What would you like to do?
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')

This comment has been minimized.

Copy link

partha0dhar commented May 29, 2016

how to do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.