I am using Nsepy to retrieve the stock data. when I type the stock symbol , I am getting the whole table but I have no idea how to put the data in csv file.Please help
Asked
Active
Viewed 1,077 times
2 Answers
1
You can save the pandas dataframe using pandas.DataFrame.to_csv(file_name='out.csv')
. More details here

Community
- 1
- 1

swapnil jariwala
- 1,064
- 2
- 12
- 19
0
In[6]: nifty_fut
Out[6]:
Symbol Expiry Open High Low Close Last
Date
2015-01-01 NIFTY 2015-01-29 8320.00 8356.0 8295.20 8343.80 8347.05
2015-01-02 NIFTY 2015-01-29 8352.25 8470.9 8352.25 8458.40 8468.00
2015-01-05 NIFTY 2015-01-29 8452.35 8492.0 8406.00 8422.85 8423.85
2015-01-06 NIFTY 2015-01-29 8422.00 8422.0 8000.00 8157.90 8150.30
2015-01-07 NIFTY 2015-01-29 8150.00 8184.0 8096.00 8141.85 8154.00
2015-01-08 NIFTY 2015-01-29 8209.00 8274.9 8193.10 8257.25 8255.00
2015-01-09 NIFTY 2015-01-29 8306.35 8334.0 8205.00 8315.50 8311.60
Save this data as a .CSV
file.
niftyfut.to_csv('niftyfut.csv', index = False, header = None)
# indexing False
niftyfut.to_csv('niftyfut.csv',index = True , header = None )
indexing True
And the data will be saved to your working directory.

sɐunıɔןɐqɐp
- 3,332
- 15
- 36
- 40

Ish Beniwal
- 3
- 2