Pandas 如何使用PyPy作为笔记本解释器?

Pandas 如何使用PyPy作为笔记本解释器?,pandas,pypy,Pandas,Pypy,我有一个脚本,用于从一些CSV文件中提取数据,并将数据分为不同的excel文件。我使用Ipython作为默认解释器,我确信它使用CPython作为默认解释器 但整个过程要完成,脚本花费的时间太多了。有人能帮助我如何使用PyPy脚本吗?我听说它比CPython快得多。 脚本是这样的: import pandas as pd import xlsxwriter as xw import csv import pymsgbox as py file1 = "vDashOpExel_Change_20

我有一个脚本,用于从一些CSV文件中提取数据,并将数据分为不同的excel文件。我使用Ipython作为默认解释器,我确信它使用CPython作为默认解释器

但整个过程要完成,脚本花费的时间太多了。有人能帮助我如何使用PyPy脚本吗?我听说它比CPython快得多。 脚本是这样的:

import pandas as pd
import xlsxwriter as xw
import csv
import pymsgbox as py

file1 = "vDashOpExel_Change_20150109.csv"
file2 = "vDashOpExel_T3Opened_20150109.csv"

path = "C:\Users\Abhishek\Desktop\Pandas Anlaysis"

def uniq(words):
    seen = set()
    for word in words:
        l = word.lower()
        if l in seen:
            continue
        seen.add(l)
        yield word

def files(file_name):
    df = pd.read_csv( path + '\\' + file_name, sep=',', encoding = 'utf-16')

    final_frame = df.dropna(how='all')

    file_list = list(uniq(list(final_frame['DOEClient'])))

    return file_list, final_frame

def fill_data(f_list, frame1=None, frame2=None):
    if f_list is not None:
        for client in f_list:
            writer = pd.ExcelWriter(path + '\\' + 'Accounts'+ '\\' + client + '.xlsx', engine='xlsxwriter')
            if frame1 is not None:
                data1 = frame1[frame1.DOEClient == client]                  # Filter the Data
                data1.to_excel(writer,'Change',index=False, header=True)    # Importing the Data to Excel File

            if frame2 is not None:
                data2 = frame2[frame2.DOEClient == client]                   # Filter the Data
                data2.to_excel(writer,'Opened',index=False, header=True)  # Importing the Data to Excel File

    else:
        py.alert('Please enter the First Parameter !!!', 'Error')
list1, frame1 = files(file1)
list2, frame2 = files(file2)

final_list = set(list1 + list2)

Abishek,你分析过代码了吗?注意:这一行:file_list=listuniqlistfinal_frame['DOEClient']可以被listfinal_frame['DOEClient']替换。str.lower.unique这将比您正在做的要快得多。建议:Ed:我想所花费的最大时间是将数据框数据导出到不同的excel工作表中。有没有更快的方法可以做到这一点,因为我想excel需要花费太多的时间。我有2.5 GB的数据,我必须使用上述代码处理并导出到excel工作表。整个过程需要将近2个小时才能完成。请告诉我一些更快的方法。