Python DataFrame导出CSV、数据库
时间:2021-07-01 10:21:17
帮助过:21人阅读
sqlalchemy import create_engine
import pandas as pd
import numpy as np
df = pd.DataFrame(np.random.randn(
3,
4))
conn_string=
‘oracle+cx_oracle://scott:tiger@127.0.0.1:1521/orcl‘
engine = create_engine(conn_string, echo=
False)
df.to_sql(‘Output‘, con=engine)
写入csv
import numpy as np
import pandas as pd
df = pd.DataFrame(np.random.randn(3, 4))
df.to_csv(‘./a.csv‘, sep=‘,‘, header=True, index=True)
Python DataFrame导出CSV、数据库
标签:div pytho port acl dex .data dom ring bsp