Skip to content

Instantly share code, notes, and snippets.

@SathishN
Forked from anonymous/Importpi.py
Created April 21, 2017 07:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SathishN/0920d6980b2ad4103307f975201d8102 to your computer and use it in GitHub Desktop.
Save SathishN/0920d6980b2ad4103307f975201d8102 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')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment