import pymongo
import pandas as pd
from pandas import Series,DataFrame
#连接数据库
client = pymongo.MongoClient('localhost',27017)
db = client['python']
# 授权
db.authenticate(name='zhaochuan',password='123456',source='admin')
info = db['zhao']
#加载数据
data = DataFrame(list(info.find()))
# 写入CSV文件
data.to_csv('NBA.csv')