Python DataFrame导出CSV、数据库
写入Oracle
from 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)
作者:Rest探路者
出处:http://www.cnblogs.com/Java-Starter/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意请保留此段声明,请在文章页面明显位置给出原文连接
Github:https://github.com/cjy513203427