如何将输出保存到CSV文件python

时间:2019-02-27 20:36:13

标签: python pandas web-scraping jupyter-notebook export-to-csv

我想将数据传输到csv文件中,但出现错误。如果将此工作簿保存为逗号分隔的值文件格式,则某些属性可能会丢失。以excel格式保存。任何帮助,将不胜感激。

import pandas as pd
npo_jobs = {}
job_no = 0

    for i in range(len(muserName)):
        userName=muserName[i]['content']
        entry=mentry[i].text
        rating=mrating[i]['content']    
        job_no+=1
        npo_jobs[job_no] = [userName, entry, rating]
    time.sleep(2)

npo_jobs_df = pd.DataFrame.from_dict(npo_jobs, orient = 'index', columns = ['userName','entry','rating'])

npo_jobs_df.to_csv('npo_jobst.csv')

0 个答案:

没有答案