Python export data (CSV format)

Python export CSV data


sep separator, default to comma (“, “)

index whether to export row serial number, default is TRUE

Whether the

header exports the column name, the default is TRUE

Get the stock data from Tushare library and export

import tushare as ts
df=ts.sh_margins(start=’2015-01-01′, end=’2015-04-19′)

df file opens as:

import tushare as ts ab = ts. Sh_margins (start = ‘2015-01-01’, end = ‘2015-04-19’).
ab to_csv (” d:// ab. CSV, “index = False)

if index changes to false, then:

Read More: