SO I want to extract stocks date from the NSE module using get_history by allowing which company to choose and want to convert the data collected into CSV file using company name as CSV file name.
X = input('Symbol of the Company:')
X = get_history(symbol=X, start = date(2020,12,1), end = date(2021,2,27))
X = DataFrame(X)
X.to_csv(X.csv)
I tried to use above to_csv but it is showing an error if I put them in quote the file is saved as X.
The solution is to keep ".csv" as string, but not X:
X = input('Symbol of the Company:')
X = get_history(symbol=X, start = date(2020,12,1), end = date(2021,2,27))
X = DataFrame(X)
X.to_csv(X + ".csv")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.