Python每日一练 09——多文件操作

news2024/11/26 12:19:16

Python每日一练 09——多文件操作

文章目录

  • Python每日一练 09——多文件操作
    • 一、单文件拆分为多个文件
    • 二、多文件合并为单文件
      • 1、获取数据文件名
      • 2、获取股票名列表
      • 3、读单支股票数据
      • 4、读多支股票数据
      • 5、多文件中数据合并到一个文件

一、单文件拆分为多个文件

我们写一个txt文件,选择十首唐诗放进去:

在这里插入图片描述

我们对着我们的文件进行分析,不难发现每一首诗开头都有3个数字序号,我们在后面对诗进行切分的时候就可以通过这个来进行。

import os 

def read_poem(file, path):
    """
    这里我们将文件读进来,并将每首诗通过前面的数字序号切分开然后保存在一个字符串中。
    """
    with open(file, 'r', encoding='utf-8') as f:
        poem = ''   # 定义一个空字符串用于接收诗
        for line in f:
            if line[:3].isdigit():  # 判断前三个字符是否为数字
                write_poem(poem, path)  # 调用函数,将一首诗写入文件
                poem = line
            else:
                poem = poem + line  # 这里判断如果不是数字开头就将其拼接到当前诗的字符串中
        write_poem(poem, path)  # 调用寒假将最后一首诗写入文件
        
def write_poem(poem, path):
    """
    传入一首诗的字符串,然后提取诗名作为文件名,然后将诗写入文件。
    """
    title = poem.split(maxsplit=1)[0]   # 这里的maxsplit参数是最大拆分数,我们只需要拆分一次
    print(title)
    with open(path + title + '.txt', 'w', encoding='utf-8') as f:
        f.write(poem)

def check_list(pathname):
    """
    这个函数用于接收路径名,返回路径下的文件名列表
    """
    return os.listdir(pathname)


if __name__ == '__main__':
    filename = '单文件拆分为多文件\唐诗十首.txt'
    pathname = './'
    read_poem(filename, pathname)
    print(check_list(pathname))

运行的结果是:

唐诗300010杜甫:佳人
011杜甫:梦李白二首之一
012杜甫:梦李白二首之二
013王维:送别
014王维:送綦毋潜落第还乡
015王维:青溪
016王维:渭川田家
017王维:西施咏
018孟浩然:秋登兰山寄张五
019孟浩然:夏日南亭怀辛大
020孟浩然:宿业师山房待丁大不至
['唐诗300首.txt', '010杜甫:佳人.txt', '011杜甫:梦李白二首之一.txt', '012杜甫:梦李白二首之二.txt', '013王维:送别.txt', '014王维:送綦毋潜落第还乡.txt', '015王维:青溪.txt', '016王维:渭川田家.txt', '017王维:西施咏.txt', '018孟浩然:秋登兰山寄张五.txt', '019孟浩然:夏日南亭怀辛大.txt', '020孟浩然:宿业师山房待丁大不至.txt']

二、多文件合并为单文件

我们文件夹内包含如下这么多股票数据文件:

在这里插入图片描述

1、获取数据文件名

import os

def get_list(pathname):
    """
    这个函数用于接收路径名,然后返回路径下的文件名列表
    """
    return os.listdir(pathname)

if __name__ == '__main__':
    pathname = '多文件合并为单文件\sample'
    print(get_list(pathname))

运行的结果是:

['600000.csv', '600004.csv', '600006.csv', '600007.csv', '600008.csv', '600009.csv', '600010.csv', '600011.csv', '600012.csv', '600015.csv', '600016.csv', '沪市股票top300.csv']

2、获取股票名列表

文件列表中有一个‘沪市股票top300.csv’,在这个文件中存储了股票代码和股票名,我们需要从中将其提取出来:

def get_stock_name(filename):
    """接收路径名为参数,返回二维列表"""
    with open(filename, encoding='utf-8') as file_obj:
        stock_name = [line.strip().split(',') for line in file_obj]  # 每根据逗号切分为列表,加入到二维列表中
    return stock_name


if __name__ == '__main__':
    file = '多文件合并为单文件\sample\沪市股票top300.csv'  # 源文件路径
    print(get_stock_name(file))

运行的结果是:

[['600000', '浦发银行'], ['600004', '白云机场'], ['600006', '东风汽车'], ['600007', '中国国贸'], ['600008', '首创股份'], ['600009', '上海机场'], ['600010', '钢联股份'], ['600011', '华能国际'], ['600012', '皖通高速'], ['600015', '华夏银行'], ['600016', '民生银行']]

3、读单支股票数据

def get_stock_data(filename):
    """接收路径名为参数,返回二维列表"""
    with open(filename) as file_obj:
        stock_data = [line.strip().split(',') for line in file_obj]  # 每根据逗号切分为列表,加入到二维列表中
    return stock_data


if __name__ == '__main__':
    file = '多文件合并为单文件\\sample\\600000.csv'  # 源文件路径
    print(get_stock_data(file))

运行的结果是:

[['Date', 'High', 'Low', 'Open', 'Close', 'Volume', 'Adj Close'], ['2010-01-04', '9.049530029296875', '8.75574016571045', '9.032979965209961', '8.768150329589844', '159964607.0', '5.441317081451416'], ['2010-01-05', '8.929530143737793', '8.602640151977539', '8.859189987182617', '8.834360122680664', '278278034.0', '5.4824042320251465'], ['2010-01-06', '8.81367015838623', '8.639880180358887', '8.809530258178711', '8.66057014465332', '233894449.0', '5.3745551109313965'], ['2010-01-07', '8.706089973449707', '8.399880409240723', '8.639880180358887', '8.466090202331543', '205990015.0', '5.253864765167236'], ['2010-01-08', '8.606780052185059', '8.399880409240723', '8.4164400100708', '8.561260223388672', '158795668.0', '5.312924861907959'], ['2010-01-11', '9.020569801330566', '8.51161003112793', '8.937809944152832', '8.561260223388672', '281073839.0', '5.312924861907959'], ['2010-01-12', '8.677120208740234', '8.383330345153809', '8.536430358886719', '8.606780052185059', '199017998.0', '5.34117317199707'], ['2010-01-13', '8.420570373535156', '8.19299030303955', '8.379190444946289', '8.205400466918945', '353804116.0', '5.092085838317871'], ['2010-01-14', '8.28402042388916', '8.126779556274414', '8.221960067749023', '8.263330459594727', '186909441.0', '5.1280364990234375'], ['2010-01-15', '8.379190444946289', '8.159890174865723', '8.28402042388916', '8.2923002243042', '167196170.0', '5.146015167236328'], ['2010-01-18', '8.395750045776367', '8.221960067749023', '8.238510131835938', '8.375060081481934', '169024525.0', '5.197373867034912'], ['2010-01-19', '8.519880294799805', '8.362640380859375', '8.379190444946289', '8.420570373535156', '169087168.0', '5.225615978240967'], ['2010-01-20', '8.495059967041016', '8.110230445861816', '8.449540138244629', '8.188850402832031', '195212592.0', '5.081815719604492'], ['2010-01-21', '8.51161003112793', '8.176440238952637', '8.226090431213379', '8.470230102539062', '225763730.0', '5.256433963775635'], ['2010-01-22', '8.730910301208496', '8.279890060424805', '8.35851001739502', '8.648159980773926', '373249590.0', '5.3668532371521'], ['2010-01-25', '8.681260108947754', '8.449540138244629', '8.50747013092041', '8.466090202331543', '193898427.0', '5.253864765167236'], ['2010-01-26', '8.648159980773926', '8.346090316772461', '8.478500366210938', '8.561260223388672', '222183082.0', '5.312924861907959'], ['2010-01-27', '8.606780052185059', '8.184709548950195', '8.552989959716797', '8.217820167541504', '227808686.0', '5.099793910980225'], ['2010-01-28', '8.213680267333984', '8.019200325012207', '8.184709548950195', '8.151610374450684', '141840241.0', '5.058705806732178']]

4、读多支股票数据

读取多个文件时,只需要遍历获取的文件名列表,把每个文件名传递给读单支股票数据的函数,就可以实现批量读取多个文件中的数据了。

import os


def get_list(pathname):
    """接收路径名为参数,返回路径下的文件名列表"""
    return os.listdir(pathname)


def get_stock_data(filename):
    """接收路径名为参数,返回二维列表"""
    with open(filename) as file_obj:
        stock_data = [line.strip().split(',') for line in file_obj]  # 每根据逗号切分为列表,加入到二维列表中
    return stock_data


def merge_data(name_ls):
    """接收文件名列表为参数"""
    for stock in name_ls:
        print(get_stock_data(path + stock))  # 
    


if __name__ == '__main__':
    path = '.\sample\'  # 源文件路径
    name_list = get_list(path)
    merge_data(name_list)
    

运行的结果是:

[['Date', 'High', 'Low', 'Open', 'Close', 'Volume', 'Adj Close'], ['2010-01-04', '9.049530029296875', '8.75574016571045', '9.032979965209961', '8.768150329589844', '159964607.0', '5.441317081451416'], ['2010-01-05', '8.929530143737793', '8.602640151977539', '8.859189987182617', '8.834360122680664', '278278034.0', '5.4824042320251465'], ['2010-01-06', '8.81367015838623', '8.639880180358887', '8.809530258178711', '8.66057014465332', '233894449.0', '5.3745551109313965'], ['2010-01-07', '8.706089973449707', '8.399880409240723', '8.639880180358887', '8.466090202331543', '205990015.0', '5.253864765167236'], ['2010-01-08', '8.606780052185059', '8.399880409240723', '8.4164400100708', '8.561260223388672', '158795668.0', '5.312924861907959'], ['2010-01-11', '9.020569801330566', '8.51161003112793', '8.937809944152832', '8.561260223388672', '281073839.0', '5.312924861907959'], ['2010-01-12', '8.677120208740234', '8.383330345153809', '8.536430358886719', '8.606780052185059', '199017998.0', '5.34117317199707'], ['2010-01-13', '8.420570373535156', '8.19299030303955', '8.379190444946289', '8.205400466918945', '353804116.0', '5.092085838317871'], ['2010-01-14', '8.28402042388916', '8.126779556274414', '8.221960067749023', '8.263330459594727', '186909441.0', '5.1280364990234375'], ['2010-01-15', '8.379190444946289', '8.159890174865723', '8.28402042388916', '8.2923002243042', '167196170.0', '5.146015167236328'], ['2010-01-18', '8.395750045776367', '8.221960067749023', '8.238510131835938', '8.375060081481934', '169024525.0', '5.197373867034912'], ['2010-01-19', '8.519880294799805', '8.362640380859375', '8.379190444946289', '8.420570373535156', '169087168.0', '5.225615978240967'], ['2010-01-20', '8.495059967041016', '8.110230445861816', '8.449540138244629', '8.188850402832031', '195212592.0', '5.081815719604492'], ['2010-01-21', '8.51161003112793', '8.176440238952637', '8.226090431213379', '8.470230102539062', '225763730.0', '5.256433963775635'], ['2010-01-22', '8.730910301208496', '8.279890060424805', '8.35851001739502', '8.648159980773926', '373249590.0', '5.3668532371521'], ['2010-01-25', '8.681260108947754', '8.449540138244629', '8.50747013092041', '8.466090202331543', '193898427.0', '5.253864765167236'], ['2010-01-26', '8.648159980773926', '8.346090316772461', '8.478500366210938', '8.561260223388672', '222183082.0', '5.312924861907959'], ['2010-01-27', '8.606780052185059', '8.184709548950195', '8.552989959716797', '8.217820167541504', '227808686.0', '5.099793910980225'], ['2010-01-28', '8.213680267333984', '8.019200325012207', '8.184709548950195', '8.151610374450684', '141840241.0', '5.058705806732178']]
[['Date', 'High', 'Low', 'Open', 'Close', 'Volume', 'Adj Close'], ['2010-01-04', '7.089660167694092', '6.993100166320801', '7.0', '7.0', '22444338.0', '4.525339603424072'], ['2010-01-05', '7.062069892883301', '6.993100166320801', '7.0', '7.027589797973633', '16052837.0', '4.543176174163818'], ['2010-01-06', '7.027589797973633', '6.910339832305908', '7.013790130615234', '6.924139976501465', '13645464.0', '4.476297378540039'], ['2010-01-07', '6.931029796600342', '6.696549892425537', '6.896550178527832', '6.744830131530762', '12994629.0', '4.360378742218018'], ['2010-01-08', '7.068970203399658', '6.7103400230407715', '6.7103400230407715', '7.020689964294434', '21639527.0', '4.538715362548828'], ['2010-01-11', '7.213789939880371', '7.020689964294434', '7.075860023498535', '7.165520191192627', '31004200.0', '4.6323442459106445'], ['2010-01-12', '7.22068977355957', '7.068970203399658', '7.124139785766602', '7.213789939880371', '18696800.0', '4.663549423217773'], ['2010-01-13', '7.241380214691162', '7.041379928588867', '7.075860023498535', '7.110340118408203', '20884404.0', '4.5966715812683105'], ['2010-01-14', '7.400000095367432', '7.089660167694092', '7.103449821472168', '7.365520000457764', '26863236.0', '4.761639595031738'], ['2010-01-15', '7.400000095367432', '7.262070178985596', '7.3586201667785645', '7.31033992767334', '14603810.0', '4.7259674072265625'], ['2010-01-18', '7.6413798332214355', '7.241380214691162', '7.31033992767334', '7.558619976043701', '27816184.0', '4.886474609375'], ['2010-01-19', '7.724140167236328', '7.482759952545166', '7.517240047454834', '7.65516996383667', '29316690.0', '4.948891639709473'], ['2010-01-20', '7.696549892425537', '7.510340213775635', '7.668970108032227', '7.579309940338135', '28765702.0', '4.899850368499756'], ['2010-01-21', '7.827589988708496', '7.448279857635498', '7.758619785308838', '7.475860118865967', '28196748.0', '4.832971572875977'], ['2010-01-22', '7.986209869384766', '7.455170154571533', '7.517240047454834', '7.6413798332214355', '58896409.0', '4.939977169036865'], ['2010-01-25', '7.77931022644043', '7.303450107574463', '7.662069797515869', '7.317240238189697', '29152040.0', '4.730428218841553'], ['2010-01-26', '7.400000095367432', '7.034480094909668', '7.317240238189697', '7.165520191192627', '21009601.0', '4.6323442459106445'], ['2010-01-27', '7.234479904174805', '7.041379928588867', '7.172410011291504', '7.089660167694092', '11260503.0', '4.583302021026611'], ['2010-01-28', '7.400000095367432', '7.034480094909668', '7.089660167694092', '7.386209964752197', '22893367.0', '4.775014877319336']]
[['Date', 'High', 'Low', 'Open', 'Close', 'Volume', 'Adj Close'], ['2010-01-04', '7.070000171661377', '6.900000095367432', '6.929999828338623', '6.909999847412109', '23281430.0', '6.176186561584473'], ['2010-01-05', '6.940000057220459', '6.75', '6.909999847412109', '6.869999885559082', '16569457.0', '6.140435695648193'], ['2010-01-06', '7.03000020980835', '6.809999942779541', '6.869999885559082', '6.889999866485596', '21867767.0', '6.158311367034912'], ['2010-01-07', '6.880000114440918', '6.539999961853027', '6.849999904632568', '6.559999942779541', '27696059.0', '5.86335563659668'], ['2010-01-08', '6.630000114440918', '6.480000019073486', '6.559999942779541', '6.619999885559082', '12747269.0', '5.916983127593994'], ['2010-01-11', '6.739999771118164', '6.5', '6.659999847412109', '6.519999980926514', '13057756.0', '5.827603340148926'], ['2010-01-12', '6.679999828338623', '6.5', '6.570000171661377', '6.679999828338623', '15268352.0', '5.970611095428467'], ['2010-01-13', '6.610000133514404', '6.489999771118164', '6.590000152587891', '6.519999980926514', '14191042.0', '5.827603340148926'], ['2010-01-14', '6.639999866485596', '6.519999980926514', '6.519999980926514', '6.619999885559082', '13557759.0', '5.916983127593994'], ['2010-01-15', '6.789999961853027', '6.599999904632568', '6.619999885559082', '6.739999771118164', '18139223.0', '6.024240016937256'], ['2010-01-18', '6.820000171661377', '6.659999847412109', '6.789999961853027', '6.760000228881836', '14608947.0', '6.042116641998291'], ['2010-01-19', '6.820000171661377', '6.639999866485596', '6.820000171661377', '6.679999828338623', '17516772.0', '5.970611095428467'], ['2010-01-20', '6.800000190734863', '6.550000190734863', '6.679999828338623', '6.579999923706055', '25474831.0', '5.881231307983398'], ['2010-01-21', '6.900000095367432', '6.690000057220459', '6.760000228881836', '6.760000228881836', '36100876.0', '6.042116641998291'], ['2010-01-22', '6.650000095367432', '6.320000171661377', '6.650000095367432', '6.400000095367432', '28445190.0', '5.720346927642822'], ['2010-01-25', '6.389999866485596', '6.190000057220459', '6.340000152587891', '6.199999809265137', '12549070.0', '5.541585445404053'], ['2010-01-26', '6.28000020980835', '5.880000114440918', '6.210000038146973', '5.900000095367432', '12855146.0', '5.273444175720215'], ['2010-01-27', '5.980000019073486', '5.699999809265137', '5.900000095367432', '5.710000038146973', '17086828.0', '5.103621482849121'], ['2010-01-28', '5.800000190734863', '5.619999885559082', '5.690000057220459', '5.769999980926514', '9583801.0', '5.157249450683594']]
[['Date', 'High', 'Low', 'Open', 'Close', 'Volume', 'Adj Close'], ['2010-01-04', '12.399999618530273', '11.829999923706055', '12.399999618530273', '11.859999656677246', '5257993.0', '9.957270622253418'], ['2010-01-05', '11.930000305175781', '11.380000114440918', '11.859999656677246', '11.479999542236328', '6131146.0', '9.63823413848877'], ['2010-01-06', '11.670000076293945', '11.479999542236328', '11.489999771118164', '11.59000015258789', '3659270.0', '9.73058795928955'], ['2010-01-07', '11.819999694824219', '11.550000190734863', '11.600000381469727', '11.739999771118164', '4344484.0', '9.856523513793945'], ['2010-01-08', '11.739999771118164', '11.430000305175781', '11.649999618530273', '11.630000114440918', '4826947.0', '9.764169692993164'], ['2010-01-11', '11.779999732971191', '11.050000190734863', '11.710000038146973', '11.3100004196167', '7622395.0', '9.49551010131836'], ['2010-01-12', '11.350000381469727', '10.90999984741211', '11.289999961853027', '11.329999923706055', '5886011.0', '9.512300491333008'], ['2010-01-13', '11.109999656677246', '10.90999984741211', '11.109999656677246', '10.949999809265137', '4733046.0', '9.19326400756836'], ['2010-01-14', '11.130000114440918', '10.930000305175781', '11.0', '11.109999656677246', '3725035.0', '9.327594757080078'], ['2010-01-15', '11.34000015258789', '11.09000015258789', '11.119999885559082', '11.199999809265137', '5977276.0', '9.403157234191895'], ['2010-01-18', '11.289999961853027', '11.130000114440918', '11.180000305175781', '11.279999732971191', '6654531.0', '9.470320701599121'], ['2010-01-19', '11.380000114440918', '11.25', '11.279999732971191', '11.300000190734863', '4918996.0', '9.487113952636719'], ['2010-01-20', '11.350000381469727', '10.8100004196167', '11.34000015258789', '10.819999694824219', '4827128.0', '9.084121704101562'], ['2010-01-21', '10.899999618530273', '10.710000038146973', '10.829999923706055', '10.850000381469727', '2787098.0', '9.109307289123535'], ['2010-01-22', '10.760000228881836', '10.359999656677246', '10.760000228881836', '10.5', '3665314.0', '8.815459251403809'], ['2010-01-25', '10.800000190734863', '10.359999656677246', '10.460000038146973', '10.699999809265137', '2584601.0', '8.983370780944824'], ['2010-01-26', '10.699999809265137', '10.449999809265137', '10.649999618530273', '10.65999984741211', '2482257.0', '8.949789047241211'], ['2010-01-27', '10.869999885559082', '10.449999809265137', '10.600000381469727', '10.850000381469727', '4022402.0', '9.109307289123535'], ['2010-01-28', '11.0', '10.600000381469727', '10.800000190734863', '11.0', '6071121.0', '9.23524284362793']]
[['Date', 'High', 'Low', 'Open', 'Close', 'Volume', 'Adj Close'], ['2010-01-04', '3.6500000953674316', '3.565000057220459', '3.634999990463257', '3.575000047683716', '28141264.0', '2.5811192989349365'], ['2010-01-05', '3.5899999141693115', '3.515000104904175', '3.5799999237060547', '3.565000057220459', '37961332.0', '2.573899269104004'], ['2010-01-06', '3.6649999618530273', '3.5950000286102295', '3.5950000286102295', '3.5999999046325684', '48343282.0', '2.5991690158843994'], ['2010-01-07', '3.609999895095825', '3.515000104904175', '3.609999895095825', '3.5250000953674316', '30403996.0', '2.5450193881988525'], ['2010-01-08', '3.555000066757202', '3.494999885559082', '3.5', '3.549999952316284', '24959566.0', '2.5630693435668945'], ['2010-01-11', '3.5999999046325684', '3.4700000286102295', '3.569999933242798', '3.5250000953674316', '38739902.0', '2.5450193881988525'], ['2010-01-12', '3.5999999046325684', '3.494999885559082', '3.5350000858306885', '3.5999999046325684', '41444678.0', '2.5991690158843994'], ['2010-01-13', '3.619999885559082', '3.5250000953674316', '3.5299999713897705', '3.5299999713897705', '34469714.0', '2.5486292839050293'], ['2010-01-14', '3.619999885559082', '3.5299999713897705', '3.5450000762939453', '3.609999895095825', '40375736.0', '2.606388807296753'], ['2010-01-15', '3.6700000762939453', '3.5950000286102295', '3.634999990463257', '3.6500000953674316', '61858412.0', '2.635268449783325'], ['2010-01-18', '3.740000009536743', '3.619999885559082', '3.6649999618530273', '3.7300000190734863', '59658852.0', '2.6930277347564697'], ['2010-01-19', '3.765000104904175', '3.674999952316284', '3.75', '3.694999933242798', '43811408.0', '2.6677582263946533'], ['2010-01-20', '3.759999990463257', '3.630000114440918', '3.7049999237060547', '3.6600000858306885', '63839868.0', '2.6424882411956787'], ['2010-01-21', '3.7300000190734863', '3.615000009536743', '3.6649999618530273', '3.694999933242798', '47452994.0', '2.6677582263946533'], ['2010-01-22', '3.694999933242798', '3.509999990463257', '3.625', '3.549999952316284', '47527890.0', '2.5630693435668945'], ['2010-01-25', '3.575000047683716', '3.5', '3.505000114440918', '3.505000114440918', '21810998.0', '2.5305800437927246'], ['2010-01-26', '3.5299999713897705', '3.299999952316284', '3.5299999713897705', '3.3350000381469727', '39234732.0', '2.407841205596924'], ['2010-01-27', '3.365000009536743', '3.25', '3.3399999141693115', '3.2699999809265137', '28790360.0', '2.3609116077423096'], ['2010-01-28', '3.3299999237060547', '3.2799999713897705', '3.2799999713897705', '3.319999933242798', '17576242.0', '2.3970110416412354']]
[['Date', 'High', 'Low', 'Open', 'Close', 'Volume', 'Adj Close'], ['2010-01-04', '18.25', '17.450000762939453', '17.450000762939453', '17.899999618530273', '47821206.0', '15.014424324035645'], ['2010-01-05', '18.280000686645508', '17.809999465942383', '17.899999618530273', '18.020000457763672', '25767982.0', '15.115082740783691'], ['2010-01-06', '18.049999237060547', '17.600000381469727', '18.0', '17.700000762939453', '19371487.0', '14.846667289733887'], ['2010-01-07', '17.959999084472656', '17.459999084472656', '17.600000381469727', '17.520000457763672', '22599261.0', '14.695682525634766'], ['2010-01-08', '18.299999237060547', '17.350000381469727', '17.40999984741211', '17.940000534057617', '28840870.0', '15.047977447509766'], ['2010-01-11', '18.68000030517578', '17.889999389648438', '18.299999237060547', '18.190000534057617', '35598501.0', '15.257675170898438'], ['2010-01-12', '18.309999465942383', '17.8799991607666', '18.190000534057617', '18.059999465942383', '32283334.0', '15.148630142211914'], ['2010-01-13', '18.790000915527344', '17.579999923706055', '17.6299991607666', '18.40999984741211', '44525929.0', '15.442209243774414'], ['2010-01-14', '19.469999313354492', '18.280000686645508', '18.450000762939453', '19.290000915527344', '37892359.0', '16.180349349975586'], ['2010-01-15', '19.40999984741211', '19.0', '19.260000228881836', '19.1200008392334', '17932939.0', '16.037755966186523'], ['2010-01-18', '21.0', '19.170000076293945', '19.18000030517578', '20.510000228881836', '52589069.0', '17.20368003845215'], ['2010-01-19', '20.729999542236328', '20.209999084472656', '20.56999969482422', '20.56999969482422', '31242861.0', '17.254011154174805'], ['2010-01-20', '20.540000915527344', '19.530000686645508', '20.540000915527344', '19.68000030517578', '34882325.0', '16.507478713989258'], ['2010-01-21', '20.450000762939453', '19.299999237060547', '19.690000534057617', '19.719999313354492', '33745950.0', '16.541030883789062'], ['2010-01-22', '20.1200008392334', '19.0', '19.59000015258789', '19.31999969482422', '38415756.0', '16.20551109313965'], ['2010-01-25', '19.280000686645508', '18.399999618530273', '19.280000686645508', '18.479999542236328', '26530113.0', '15.500926971435547'], ['2010-01-26', '18.700000762939453', '17.860000610351562', '18.40999984741211', '18.559999465942383', '31250551.0', '15.568026542663574'], ['2010-01-27', '18.649999618530273', '18.040000915527344', '18.399999618530273', '18.18000030517578', '18448373.0', '15.249288558959961'], ['2010-01-28', '18.549999237060547', '18.100000381469727', '18.149999618530273', '18.549999237060547', '17711697.0', '15.559640884399414']]
[['Date', 'High', 'Low', 'Open', 'Close', 'Volume', 'Adj Close'], ['2010-01-04', '1.664289951324463', '1.6357100009918213', '1.6607099771499634', '1.6357100009918213', '87618140.0', '1.5676798820495605'], ['2010-01-05', '1.6428600549697876', '1.600000023841858', '1.6357100009918213', '1.6285699605941772', '96975623.0', '1.560836672782898'], ['2010-01-06', '1.6571400165557861', '1.6071399450302124', '1.625', '1.632140040397644', '101696090.0', '1.5642582178115845'], ['2010-01-07', '1.632140040397644', '1.5892900228500366', '1.632140040397644', '1.5928599834442139', '88698358.0', '1.5266119241714478'], ['2010-01-08', '1.6071399450302124', '1.571429967880249', '1.5928599834442139', '1.600000023841858', '83714400.0', '1.5334550142288208'], ['2010-01-11', '1.6392899751663208', '1.5892900228500366', '1.632140040397644', '1.5928599834442139', '62564902.0', '1.5266119241714478'], ['2010-01-12', '1.617859959602356', '1.5750000476837158', '1.5750000476837158', '1.6142899990081787', '69193312.0', '1.5471504926681519'], ['2010-01-13', '1.600000023841858', '1.5750000476837158', '1.5928599834442139', '1.578570008277893', '91232425.0', '1.5129163265228271'], ['2010-01-14', '1.5964299440383911', '1.5750000476837158', '1.578570008277893', '1.5928599834442139', '63042263.0', '1.5266119241714478'], ['2010-01-15', '1.5964299440383911', '1.571429967880249', '1.5928599834442139', '1.5928599834442139', '70785467.0', '1.5266119241714478'], ['2010-01-18', '1.5964299440383911', '1.571429967880249', '1.585710048675537', '1.5928599834442139', '72970103.0', '1.5266119241714478'], ['2010-01-19', '1.6285699605941772', '1.585710048675537', '1.5928599834442139', '1.6214300394058228', '136309846.0', '1.553993582725525'], ['2010-01-20', '1.6357100009918213', '1.5607099533081055', '1.6214300394058228', '1.571429967880249', '106613500.0', '1.506073236465454'], ['2010-01-21', '1.5821399688720703', '1.553570032119751', '1.571429967880249', '1.5642900466918945', '66865142.0', '1.499230146408081'], ['2010-01-22', '1.5607099533081055', '1.5035699605941772', '1.5571399927139282', '1.5321400165557861', '91190607.0', '1.4684172868728638'], ['2010-01-25', '1.524999976158142', '1.4964300394058228', '1.5214300155639648', '1.5', '58433757.0', '1.4376139640808105'], ['2010-01-26', '1.507140040397644', '1.428570032119751', '1.5', '1.4571399688720703', '74686721.0', '1.3965364694595337'], ['2010-01-27', '1.4642900228500366', '1.428570032119751', '1.4571399688720703', '1.4500000476837158', '49209558.0', '1.3896936178207397'], ['2010-01-28', '1.4678599834442139', '1.4392900466918945', '1.4500000476837158', '1.4571399688720703', '36010957.0', '1.3965364694595337']]
[['Date', 'High', 'Low', 'Open', 'Close', 'Volume', 'Adj Close'], ['2010-01-04', '8.130000114440918', '7.989999771118164', '8.109999656677246', '8.010000228881836', '13471969.0', '5.488150119781494'], ['2010-01-05', '8.09000015258789', '7.900000095367432', '8.029999732971191', '8.09000015258789', '12001396.0', '5.54296350479126'], ['2010-01-06', '8.140000343322754', '8.039999961853027', '8.100000381469727', '8.039999961853027', '13496984.0', '5.508705139160156'], ['2010-01-07', '8.020000457763672', '7.849999904632568', '8.020000457763672', '7.860000133514404', '10262641.0', '5.3853759765625'], ['2010-01-08', '7.860000133514404', '7.860000133514404', '7.860000133514404', '7.860000133514404', '0.0', '5.3853759765625'], ['2010-01-11', '7.860000133514404', '7.860000133514404', '7.860000133514404', '7.860000133514404', '0.0', '5.3853759765625'], ['2010-01-12', '7.860000133514404', '7.860000133514404', '7.860000133514404', '7.860000133514404', '0.0', '5.3853759765625'], ['2010-01-13', '7.860000133514404', '7.860000133514404', '7.860000133514404', '7.860000133514404', '0.0', '5.3853759765625'], ['2010-01-14', '7.860000133514404', '7.860000133514404', '7.860000133514404', '7.860000133514404', '0.0', '5.3853759765625'], ['2010-01-15', '7.860000133514404', '7.860000133514404', '7.860000133514404', '7.860000133514404', '0.0', '5.3853759765625'], ['2010-01-18', '8.34000015258789', '7.800000190734863', '7.829999923706055', '8.020000457763672', '20917280.0', '5.495001792907715'], ['2010-01-19', '8.109999656677246', '7.989999771118164', '8.039999961853027', '8.020000457763672', '14115371.0', '5.495001792907715'], ['2010-01-20', '8.050000190734863', '7.78000020980835', '8.020000457763672', '7.800000190734863', '13483884.0', '5.344265937805176'], ['2010-01-21', '7.860000133514404', '7.71999979019165', '7.800000190734863', '7.78000020980835', '8300195.0', '5.330562114715576'], ['2010-01-22', '7.809999942779541', '7.630000114440918', '7.75', '7.710000038146973', '7681392.0', '5.282601833343506'], ['2010-01-25', '7.800000190734863', '7.639999866485596', '7.679999828338623', '7.71999979019165', '5071674.0', '5.289453506469727'], ['2010-01-26', '7.739999771118164', '7.389999866485596', '7.71999979019165', '7.409999847412109', '6956304.0', '5.077053546905518'], ['2010-01-27', '7.489999771118164', '7.360000133514404', '7.409999847412109', '7.369999885559082', '4690595.0', '5.049646854400635'], ['2010-01-28', '7.429999828338623', '7.25', '7.400000095367432', '7.289999961853027', '7924234.0', '4.994833469390869']]
[['Date', 'High', 'Low', 'Open', 'Close', 'Volume', 'Adj Close'], ['2010-01-04', '5.96999979019165', '5.860000133514404', '5.96999979019165', '5.869999885559082', '4457081.0', '3.938664197921753'], ['2010-01-05', '5.909999847412109', '5.809999942779541', '5.880000114440918', '5.900000095367432', '4036819.0', '3.958794355392456'], ['2010-01-06', '5.960000038146973', '5.860000133514404', '5.900000095367432', '5.880000114440918', '4436603.0', '3.9453744888305664'], ['2010-01-07', '5.889999866485596', '5.730000019073486', '5.860000133514404', '5.760000228881836', '4516599.0', '3.864856719970703'], ['2010-01-08', '5.829999923706055', '5.730000019073486', '5.739999771118164', '5.809999942779541', '3889700.0', '3.898404836654663'], ['2010-01-11', '6.039999961853027', '5.800000190734863', '5.849999904632568', '6.03000020980835', '15850923.0', '4.046021938323975'], ['2010-01-12', '6.369999885559082', '5.989999771118164', '6.019999980926514', '6.309999942779541', '25963574.0', '4.233896255493164'], ['2010-01-13', '6.53000020980835', '6.239999771118164', '6.239999771118164', '6.28000020980835', '25576301.0', '4.2137675285339355'], ['2010-01-14', '6.420000076293945', '6.21999979019165', '6.360000133514404', '6.329999923706055', '11431174.0', '4.247316360473633'], ['2010-01-15', '6.349999904632568', '6.239999771118164', '6.300000190734863', '6.309999942779541', '7707084.0', '4.233896255493164'], ['2010-01-18', '6.550000190734863', '6.230000019073486', '6.300000190734863', '6.510000228881836', '16247472.0', '4.368093013763428'], ['2010-01-19', '7.159999847412109', '6.449999809265137', '6.510000228881836', '7.159999847412109', '39701483.0', '4.804232120513916'], ['2010-01-20', '7.880000114440918', '7.349999904632568', '7.349999904632568', '7.880000114440918', '127174906.0', '5.2873382568359375'], ['2010-01-21', '7.75', '7.199999809265137', '7.699999809265137', '7.519999980926514', '69143612.0', '5.045784950256348'], ['2010-01-22', '8.15999984741211', '7.53000020980835', '7.579999923706055', '7.619999885559082', '81485220.0', '5.1128830909729'], ['2010-01-25', '7.449999809265137', '7.099999904632568', '7.300000190734863', '7.159999847412109', '32671736.0', '4.804232120513916'], ['2010-01-26', '7.289999961853027', '6.5', '7.159999847412109', '6.760000228881836', '31443993.0', '4.535838603973389'], ['2010-01-27', '7.059999942779541', '6.519999980926514', '6.659999847412109', '6.820000171661377', '34603457.0', '4.57609748840332'], ['2010-01-28', '7.349999904632568', '6.659999847412109', '6.679999828338623', '7.320000171661377', '37295526.0', '4.911588668823242']]
[['Date', 'High', 'Low', 'Open', 'Close', 'Volume', 'Adj Close'], ['2010-01-04', '6.714739799499512', '6.543799877166748', '6.629270076751709', '6.559830188751221', '84191152.0', '4.2687907218933105'], ['2010-01-05', '6.752140045166016', '6.463679790496826', '6.60791015625', '6.725430011749268', '110703114.0', '4.376554489135742'], ['2010-01-06', '6.704060077667236', '6.469019889831543', '6.693379878997803', '6.479700088500977', '101824254.0', '4.216646194458008'], ['2010-01-07', '6.543799877166748', '6.3140997886657715', '6.479700088500977', '6.346149921417236', '95875566.0', '4.129738807678223'], ['2010-01-08', '6.431620121002197', '6.25', '6.303420066833496', '6.388889789581299', '53191613.0', '4.1575517654418945'], ['2010-01-11', '6.677350044250488', '6.415599822998047', '6.613249778747559', '6.442309856414795', '97118276.0', '4.192315101623535'], ['2010-01-12', '6.661320209503174', '6.2927398681640625', '6.410260200500488', '6.629270076751709', '91346009.0', '4.313979148864746'], ['2010-01-13', '6.47435998916626', '6.143159866333008', '6.410260200500488', '6.191239833831787', '136231818.0', '4.0289306640625'], ['2010-01-14', '6.244659900665283', '6.079060077667236', '6.2072601318359375', '6.196579933166504', '65020622.0', '4.032406806945801'], ['2010-01-15', '6.282050132751465', '6.137819766998291', '6.1859002113342285', '6.191239833831787', '53218633.0', '4.0289306640625'], ['2010-01-18', '6.180560111999512', '6.079060077667236', '6.1591901779174805', '6.148499965667725', '55010030.0', '4.0011186599731445'], ['2010-01-19', '6.255340099334717', '6.137819766998291', '6.175209999084473', '6.169869899749756', '50164823.0', '4.0150251388549805'], ['2010-01-20', '6.212609767913818', '5.876070022583008', '6.1859002113342285', '5.908120155334473', '68328187.0', '3.8446922302246094'], ['2010-01-21', '6.143159866333008', '5.886750221252441', '5.886750221252441', '6.079060077667236', '67374888.0', '3.9559309482574463'], ['2010-01-22', '6.3408098220825195', '5.945509910583496', '5.98291015625', '6.2660298347473145', '111889562.0', '4.077601432800293'], ['2010-01-25', '6.287390232086182', '6.127140045166016', '6.148499965667725', '6.143159866333008', '46498007.0', '3.9976444244384766']]
[['Date', 'High', 'Low', 'Open', 'Close', 'Volume', 'Adj Close'], ['2010-01-04', '4.716430187225342', '4.583330154418945', '4.646989822387695', '4.589119911193848', '420887466.0', '2.9446263313293457'], ['2010-01-05', '4.7106499671936035', '4.513889789581299', '4.623839855194092', '4.670139789581299', '397762846.0', '2.996613025665283'], ['2010-01-06', '4.675930023193359', '4.571760177612305', '4.646989822387695', '4.577549934387207', '279384090.0', '2.937202215194702'], ['2010-01-07', '4.583330154418945', '4.427080154418945', '4.571760177612305', '4.456019878387451', '287722658.0', '2.859222173690796'], ['2010-01-08', '4.519680023193359', '4.421299934387207', '4.450230121612549', '4.502309799194336', '203065401.0', '2.8889243602752686'], ['2010-01-11', '4.751160144805908', '4.513889789581299', '4.716430187225342', '4.5543999671936035', '446305394.0', '2.9223475456237793'], ['2010-01-12', '4.606480121612549', '4.3981499671936035', '4.5254597663879395', '4.577549934387207', '316389327.0', '2.937202215194702'], ['2010-01-13', '4.473380088806152', '4.340280055999756', '4.427080154418945', '4.375', '500350462.0', '2.8072350025177'], ['2010-01-14', '4.403940200805664', '4.311339855194092', '4.3981499671936035', '4.3807902336120605', '250090571.0', '2.810950517654419'], ['2010-01-15', '4.421299934387207', '4.317130088806152', '4.386569976806641', '4.3807902336120605', '200494565.0', '2.810950517654419'], ['2010-01-18', '4.403940200805664', '4.340280055999756', '4.346059799194336', '4.392360210418701', '195516441.0', '2.8183746337890625'], ['2010-01-19', '4.484950065612793', '4.403940200805664', '4.403940200805664', '4.461810111999512', '266631853.0', '2.8629374504089355'], ['2010-01-20', '4.479169845581055', '4.317130088806152', '4.473380088806152', '4.340280055999756', '217100028.0', '2.78495717048645'], ['2010-01-21', '4.456019878387451', '4.334489822387695', '4.346059799194336', '4.415510177612305', '206920647.0', '2.833228826522827'], ['2010-01-22', '4.583330154418945', '4.328700065612793', '4.3518500328063965', '4.502309799194336', '478445910.0', '2.8889243602752686'], ['2010-01-25', '4.542819976806641', '4.3981499671936035', '4.427080154418945', '4.415510177612305', '210411535.0', '2.833228826522827'], ['2010-01-26', '4.479169845581055', '4.340280055999756', '4.409719944000244', '4.3692097663879395', '195809873.0', '2.8035202026367188'], ['2010-01-27', '4.415510177612305', '4.2129597663879395', '4.3807902336120605', '4.236110210418701', '206082627.0', '2.71811580657959'], ['2010-01-28', '4.259260177612305', '4.166669845581055', '4.253469944000244', '4.1956000328063965', '176181287.0', '2.6921229362487793']]
[['600000', '浦发银行'], ['600004', '白云机场'], ['600006', '东风汽车'], ['600007', '中国国贸'], ['600008', '首创股份'], ['600009', '上海机场'], ['600010', '钢联股份'], ['600011', '华能国际'], ['600012', '皖通高速'], ['600015', '华夏银行'], ['600016', '民生银行']]

每个文件中的数据读取为一个二维列表,下面我们把多个二维列表合并为一个二维列表:

import os


def get_list(pathname):
    """接收路径名为参数,返回路径下的文件名列表"""
    return os.listdir(pathname)[:-1]  # [:-1]返回去除最后一个文件的列表,去掉 '沪市股票top300.csv'


def merge_data(name_ls):
    """接收文件名为列表,返回二维列表"""
    stock_data = []
    for filename in name_ls:
        with open(path + filename) as file_obj:
            title = file_obj.readline()  # 读取第一行,标题行,返回字符串
            title = title.strip().split(',')  # 为标题行增加股票代码
            for line in file_obj:  # 遍历文件剩余行
                data = line.strip().split(',')  # 当前行数据切分为列表
                stock_data.append(data)  # 每行列表,增加到二维列表中
    return [title] + stock_data    # 标题行做为二维列表中的第一个元素



if __name__ == '__main__':
    path = '.\sample\'  # 源文件路径
    new_file = '合并的股票数据.csv'
    name_list = get_list(path)
    stock_info = merge_data(name_list)
    print(stock_info)

运行的结果是:

[['Date', 'High', 'Low', 'Open', 'Close', 'Volume', 'Adj Close'], ['2010-01-04', '9.049530029296875', '8.75574016571045', '9.032979965209961', '8.768150329589844', '159964607.0', '5.441317081451416'], ['2010-01-05', '8.929530143737793', '8.602640151977539', '8.859189987182617', '8.834360122680664', '278278034.0', '5.4824042320251465'], ['2010-01-06', '8.81367015838623', '8.639880180358887', '8.809530258178711', '8.66057014465332', '233894449.0', '5.3745551109313965'], ['2010-01-07', '8.706089973449707', '8.399880409240723', '8.639880180358887', '8.466090202331543', '205990015.0', '5.253864765167236'], ['2010-01-08', '8.606780052185059', '8.399880409240723', '8.4164400100708', '8.561260223388672', '158795668.0', '5.312924861907959'], ['2010-01-11', '9.020569801330566', '8.51161003112793', '8.937809944152832', '8.561260223388672', '281073839.0', '5.312924861907959'], ['2010-01-12', '8.677120208740234', '8.383330345153809', '8.536430358886719', '8.606780052185059', '199017998.0', '5.34117317199707'], ['2010-01-13', '8.420570373535156', '8.19299030303955', '8.379190444946289', '8.205400466918945', '353804116.0', '5.092085838317871'], ['2010-01-14', '8.28402042388916', '8.126779556274414', '8.221960067749023', '8.263330459594727', '186909441.0', '5.1280364990234375'], ['2010-01-15', '8.379190444946289', '8.159890174865723', '8.28402042388916', '8.2923002243042', '167196170.0', '5.146015167236328'], ['2010-01-18', '8.395750045776367', '8.221960067749023', '8.238510131835938', '8.375060081481934', '169024525.0', '5.197373867034912'], ['2010-01-19', '8.519880294799805', '8.362640380859375', '8.379190444946289', '8.420570373535156', '169087168.0', '5.225615978240967'], ['2010-01-20', '8.495059967041016', '8.110230445861816', '8.449540138244629', '8.188850402832031', '195212592.0', '5.081815719604492'], ['2010-01-21', '8.51161003112793', '8.176440238952637', '8.226090431213379', '8.470230102539062', '225763730.0', '5.256433963775635'], ['2010-01-22', '8.730910301208496', '8.279890060424805', '8.35851001739502', '8.648159980773926', '373249590.0', '5.3668532371521'], ['2010-01-25', '8.681260108947754', '8.449540138244629', '8.50747013092041', '8.466090202331543', '193898427.0', '5.253864765167236'], ['2010-01-26', '8.648159980773926', '8.346090316772461', '8.478500366210938', '8.561260223388672', '222183082.0', '5.312924861907959'], ['2010-01-27', '8.606780052185059', '8.184709548950195', '8.552989959716797', '8.217820167541504', '227808686.0', '5.099793910980225'], ['2010-01-28', '8.213680267333984', '8.019200325012207', '8.184709548950195', '8.151610374450684', '141840241.0', '5.058705806732178'], ['2010-01-04', '7.089660167694092', '6.993100166320801', '7.0', '7.0', '22444338.0', '4.525339603424072'], ['2010-01-05', '7.062069892883301', '6.993100166320801', '7.0', '7.027589797973633', '16052837.0', '4.543176174163818'], ['2010-01-06', '7.027589797973633', '6.910339832305908', '7.013790130615234', '6.924139976501465', '13645464.0', '4.476297378540039'], ['2010-01-07', '6.931029796600342', '6.696549892425537', '6.896550178527832', '6.744830131530762', '12994629.0', '4.360378742218018'], ['2010-01-08', '7.068970203399658', '6.7103400230407715', '6.7103400230407715', '7.020689964294434', '21639527.0', '4.538715362548828'], ['2010-01-11', '7.213789939880371', '7.020689964294434', '7.075860023498535', '7.165520191192627', '31004200.0', '4.6323442459106445'], ['2010-01-12', '7.22068977355957', '7.068970203399658', '7.124139785766602', '7.213789939880371', '18696800.0', '4.663549423217773'], ['2010-01-13', '7.241380214691162', '7.041379928588867', '7.075860023498535', '7.110340118408203', '20884404.0', '4.5966715812683105'], ['2010-01-14', '7.400000095367432', '7.089660167694092', '7.103449821472168', '7.365520000457764', '26863236.0', '4.761639595031738'], ['2010-01-15', '7.400000095367432', '7.262070178985596', '7.3586201667785645', '7.31033992767334', '14603810.0', '4.7259674072265625'], ['2010-01-18', '7.6413798332214355', '7.241380214691162', '7.31033992767334', '7.558619976043701', '27816184.0', '4.886474609375'], ['2010-01-19', '7.724140167236328', '7.482759952545166', '7.517240047454834', '7.65516996383667', '29316690.0', '4.948891639709473'], ['2010-01-20', '7.696549892425537', '7.510340213775635', '7.668970108032227', '7.579309940338135', '28765702.0', '4.899850368499756'], ['2010-01-21', '7.827589988708496', '7.448279857635498', '7.758619785308838', '7.475860118865967', '28196748.0', '4.832971572875977'], ['2010-01-22', '7.986209869384766', '7.455170154571533', '7.517240047454834', '7.6413798332214355', '58896409.0', '4.939977169036865'], ['2010-01-25', '7.77931022644043', '7.303450107574463', '7.662069797515869', '7.317240238189697', '29152040.0', '4.730428218841553'], ['2010-01-26', '7.400000095367432', '7.034480094909668', '7.317240238189697', '7.165520191192627', '21009601.0', '4.6323442459106445'], ['2010-01-27', '7.234479904174805', '7.041379928588867', '7.172410011291504', '7.089660167694092', '11260503.0', '4.583302021026611'], ['2010-01-28', '7.400000095367432', '7.034480094909668', '7.089660167694092', '7.386209964752197', '22893367.0', '4.775014877319336'], ['2010-01-04', '7.070000171661377', '6.900000095367432', '6.929999828338623', '6.909999847412109', '23281430.0', '6.176186561584473'], ['2010-01-05', '6.940000057220459', '6.75', '6.909999847412109', '6.869999885559082', '16569457.0', '6.140435695648193'], ['2010-01-06', '7.03000020980835', '6.809999942779541', '6.869999885559082', '6.889999866485596', '21867767.0', '6.158311367034912'], ['2010-01-07', '6.880000114440918', '6.539999961853027', '6.849999904632568', '6.559999942779541', '27696059.0', '5.86335563659668'], ['2010-01-08', '6.630000114440918', '6.480000019073486', '6.559999942779541', '6.619999885559082', '12747269.0', '5.916983127593994'], ['2010-01-11', '6.739999771118164', '6.5', '6.659999847412109', '6.519999980926514', '13057756.0', '5.827603340148926'], ['2010-01-12', '6.679999828338623', '6.5', '6.570000171661377', '6.679999828338623', '15268352.0', '5.970611095428467'], ['2010-01-13', '6.610000133514404', '6.489999771118164', '6.590000152587891', '6.519999980926514', '14191042.0', '5.827603340148926'], ['2010-01-14', '6.639999866485596', '6.519999980926514', '6.519999980926514', '6.619999885559082', '13557759.0', '5.916983127593994'], ['2010-01-15', '6.789999961853027', '6.599999904632568', '6.619999885559082', '6.739999771118164', '18139223.0', '6.024240016937256'], ['2010-01-18', '6.820000171661377', '6.659999847412109', '6.789999961853027', '6.760000228881836', '14608947.0', '6.042116641998291'], ['2010-01-19', '6.820000171661377', '6.639999866485596', '6.820000171661377', '6.679999828338623', '17516772.0', '5.970611095428467'], ['2010-01-20', '6.800000190734863', '6.550000190734863', '6.679999828338623', '6.579999923706055', '25474831.0', '5.881231307983398'], ['2010-01-21', '6.900000095367432', '6.690000057220459', '6.760000228881836', '6.760000228881836', '36100876.0', '6.042116641998291'], ['2010-01-22', '6.650000095367432', '6.320000171661377', '6.650000095367432', '6.400000095367432', '28445190.0', '5.720346927642822'], ['2010-01-25', '6.389999866485596', '6.190000057220459', '6.340000152587891', '6.199999809265137', '12549070.0', '5.541585445404053'], ['2010-01-26', '6.28000020980835', '5.880000114440918', '6.210000038146973', '5.900000095367432', '12855146.0', '5.273444175720215'], ['2010-01-27', '5.980000019073486', '5.699999809265137', '5.900000095367432', '5.710000038146973', '17086828.0', '5.103621482849121'], ['2010-01-28', '5.800000190734863', '5.619999885559082', '5.690000057220459', '5.769999980926514', '9583801.0', '5.157249450683594'], ['2010-01-04', '12.399999618530273', '11.829999923706055', '12.399999618530273', '11.859999656677246', '5257993.0', '9.957270622253418'], ['2010-01-05', '11.930000305175781', '11.380000114440918', '11.859999656677246', '11.479999542236328', '6131146.0', '9.63823413848877'], ['2010-01-06', '11.670000076293945', '11.479999542236328', '11.489999771118164', '11.59000015258789', '3659270.0', '9.73058795928955'], ['2010-01-07', '11.819999694824219', '11.550000190734863', '11.600000381469727', '11.739999771118164', '4344484.0', '9.856523513793945'], ['2010-01-08', '11.739999771118164', '11.430000305175781', '11.649999618530273', '11.630000114440918', '4826947.0', '9.764169692993164'], ['2010-01-11', '11.779999732971191', '11.050000190734863', '11.710000038146973', '11.3100004196167', '7622395.0', '9.49551010131836'], ['2010-01-12', '11.350000381469727', '10.90999984741211', '11.289999961853027', '11.329999923706055', '5886011.0', '9.512300491333008'], ['2010-01-13', '11.109999656677246', '10.90999984741211', '11.109999656677246', '10.949999809265137', '4733046.0', '9.19326400756836'], ['2010-01-14', '11.130000114440918', '10.930000305175781', '11.0', '11.109999656677246', '3725035.0', '9.327594757080078'], ['2010-01-15', '11.34000015258789', '11.09000015258789', '11.119999885559082', '11.199999809265137', '5977276.0', '9.403157234191895'], ['2010-01-18', '11.289999961853027', '11.130000114440918', '11.180000305175781', '11.279999732971191', '6654531.0', '9.470320701599121'], ['2010-01-19', '11.380000114440918', '11.25', '11.279999732971191', '11.300000190734863', '4918996.0', '9.487113952636719'], ['2010-01-20', '11.350000381469727', '10.8100004196167', '11.34000015258789', '10.819999694824219', '4827128.0', '9.084121704101562'], ['2010-01-21', '10.899999618530273', '10.710000038146973', '10.829999923706055', '10.850000381469727', '2787098.0', '9.109307289123535'], ['2010-01-22', '10.760000228881836', '10.359999656677246', '10.760000228881836', '10.5', '3665314.0', '8.815459251403809'], ['2010-01-25', '10.800000190734863', '10.359999656677246', '10.460000038146973', '10.699999809265137', '2584601.0', '8.983370780944824'], ['2010-01-26', '10.699999809265137', '10.449999809265137', '10.649999618530273', '10.65999984741211', '2482257.0', '8.949789047241211'], ['2010-01-27', '10.869999885559082', '10.449999809265137', '10.600000381469727', '10.850000381469727', '4022402.0', '9.109307289123535'], ['2010-01-28', '11.0', '10.600000381469727', '10.800000190734863', '11.0', '6071121.0', '9.23524284362793'], ['2010-01-04', '3.6500000953674316', '3.565000057220459', '3.634999990463257', '3.575000047683716', '28141264.0', '2.5811192989349365'], ['2010-01-05', '3.5899999141693115', '3.515000104904175', '3.5799999237060547', '3.565000057220459', '37961332.0', '2.573899269104004'], ['2010-01-06', '3.6649999618530273', '3.5950000286102295', '3.5950000286102295', '3.5999999046325684', '48343282.0', '2.5991690158843994'], ['2010-01-07', '3.609999895095825', '3.515000104904175', '3.609999895095825', '3.5250000953674316', '30403996.0', '2.5450193881988525'], ['2010-01-08', '3.555000066757202', '3.494999885559082', '3.5', '3.549999952316284', '24959566.0', '2.5630693435668945'], ['2010-01-11', '3.5999999046325684', '3.4700000286102295', '3.569999933242798', '3.5250000953674316', '38739902.0', '2.5450193881988525'], ['2010-01-12', '3.5999999046325684', '3.494999885559082', '3.5350000858306885', '3.5999999046325684', '41444678.0', '2.5991690158843994'], ['2010-01-13', '3.619999885559082', '3.5250000953674316', '3.5299999713897705', '3.5299999713897705', '34469714.0', '2.5486292839050293'], ['2010-01-14', '3.619999885559082', '3.5299999713897705', '3.5450000762939453', '3.609999895095825', '40375736.0', '2.606388807296753'], ['2010-01-15', '3.6700000762939453', '3.5950000286102295', '3.634999990463257', '3.6500000953674316', '61858412.0', '2.635268449783325'], ['2010-01-18', '3.740000009536743', '3.619999885559082', '3.6649999618530273', '3.7300000190734863', '59658852.0', '2.6930277347564697'], ['2010-01-19', '3.765000104904175', '3.674999952316284', '3.75', '3.694999933242798', '43811408.0', '2.6677582263946533'], ['2010-01-20', '3.759999990463257', '3.630000114440918', '3.7049999237060547', '3.6600000858306885', '63839868.0', '2.6424882411956787'], ['2010-01-21', '3.7300000190734863', '3.615000009536743', '3.6649999618530273', '3.694999933242798', '47452994.0', '2.6677582263946533'], ['2010-01-22', '3.694999933242798', '3.509999990463257', '3.625', '3.549999952316284', '47527890.0', '2.5630693435668945'], ['2010-01-25', '3.575000047683716', '3.5', '3.505000114440918', '3.505000114440918', '21810998.0', '2.5305800437927246'], ['2010-01-26', '3.5299999713897705', '3.299999952316284', '3.5299999713897705', '3.3350000381469727', '39234732.0', '2.407841205596924'], ['2010-01-27', '3.365000009536743', '3.25', '3.3399999141693115', '3.2699999809265137', '28790360.0', '2.3609116077423096'], ['2010-01-28', '3.3299999237060547', '3.2799999713897705', '3.2799999713897705', '3.319999933242798', '17576242.0', '2.3970110416412354'], ['2010-01-04', '18.25', '17.450000762939453', '17.450000762939453', '17.899999618530273', '47821206.0', '15.014424324035645'], ['2010-01-05', '18.280000686645508', '17.809999465942383', '17.899999618530273', '18.020000457763672', '25767982.0', '15.115082740783691'], ['2010-01-06', '18.049999237060547', '17.600000381469727', '18.0', '17.700000762939453', '19371487.0', '14.846667289733887'], ['2010-01-07', '17.959999084472656', '17.459999084472656', '17.600000381469727', '17.520000457763672', '22599261.0', '14.695682525634766'], ['2010-01-08', '18.299999237060547', '17.350000381469727', '17.40999984741211', '17.940000534057617', '28840870.0', '15.047977447509766'], ['2010-01-11', '18.68000030517578', '17.889999389648438', '18.299999237060547', '18.190000534057617', '35598501.0', '15.257675170898438'], ['2010-01-12', '18.309999465942383', '17.8799991607666', '18.190000534057617', '18.059999465942383', '32283334.0', '15.148630142211914'], ['2010-01-13', '18.790000915527344', '17.579999923706055', '17.6299991607666', '18.40999984741211', '44525929.0', '15.442209243774414'], ['2010-01-14', '19.469999313354492', '18.280000686645508', '18.450000762939453', '19.290000915527344', '37892359.0', '16.180349349975586'], ['2010-01-15', '19.40999984741211', '19.0', '19.260000228881836', '19.1200008392334', '17932939.0', '16.037755966186523'], ['2010-01-18', '21.0', '19.170000076293945', '19.18000030517578', '20.510000228881836', '52589069.0', '17.20368003845215'], ['2010-01-19', '20.729999542236328', '20.209999084472656', '20.56999969482422', '20.56999969482422', '31242861.0', '17.254011154174805'], ['2010-01-20', '20.540000915527344', '19.530000686645508', '20.540000915527344', '19.68000030517578', '34882325.0', '16.507478713989258'], ['2010-01-21', '20.450000762939453', '19.299999237060547', '19.690000534057617', '19.719999313354492', '33745950.0', '16.541030883789062'], ['2010-01-22', '20.1200008392334', '19.0', '19.59000015258789', '19.31999969482422', '38415756.0', '16.20551109313965'], ['2010-01-25', '19.280000686645508', '18.399999618530273', '19.280000686645508', '18.479999542236328', '26530113.0', '15.500926971435547'], ['2010-01-26', '18.700000762939453', '17.860000610351562', '18.40999984741211', '18.559999465942383', '31250551.0', '15.568026542663574'], ['2010-01-27', '18.649999618530273', '18.040000915527344', '18.399999618530273', '18.18000030517578', '18448373.0', '15.249288558959961'], ['2010-01-28', '18.549999237060547', '18.100000381469727', '18.149999618530273', '18.549999237060547', '17711697.0', '15.559640884399414'], ['2010-01-04', '1.664289951324463', '1.6357100009918213', '1.6607099771499634', '1.6357100009918213', '87618140.0', '1.5676798820495605'], ['2010-01-05', '1.6428600549697876', '1.600000023841858', '1.6357100009918213', '1.6285699605941772', '96975623.0', '1.560836672782898'], ['2010-01-06', '1.6571400165557861', '1.6071399450302124', '1.625', '1.632140040397644', '101696090.0', '1.5642582178115845'], ['2010-01-07', '1.632140040397644', '1.5892900228500366', '1.632140040397644', '1.5928599834442139', '88698358.0', '1.5266119241714478'], ['2010-01-08', '1.6071399450302124', '1.571429967880249', '1.5928599834442139', '1.600000023841858', '83714400.0', '1.5334550142288208'], ['2010-01-11', '1.6392899751663208', '1.5892900228500366', '1.632140040397644', '1.5928599834442139', '62564902.0', '1.5266119241714478'], ['2010-01-12', '1.617859959602356', '1.5750000476837158', '1.5750000476837158', '1.6142899990081787', '69193312.0', '1.5471504926681519'], ['2010-01-13', '1.600000023841858', '1.5750000476837158', '1.5928599834442139', '1.578570008277893', '91232425.0', '1.5129163265228271'], ['2010-01-14', '1.5964299440383911', '1.5750000476837158', '1.578570008277893', '1.5928599834442139', '63042263.0', '1.5266119241714478'], ['2010-01-15', '1.5964299440383911', '1.571429967880249', '1.5928599834442139', '1.5928599834442139', '70785467.0', '1.5266119241714478'], ['2010-01-18', '1.5964299440383911', '1.571429967880249', '1.585710048675537', '1.5928599834442139', '72970103.0', '1.5266119241714478'], ['2010-01-19', '1.6285699605941772', '1.585710048675537', '1.5928599834442139', '1.6214300394058228', '136309846.0', '1.553993582725525'], ['2010-01-20', '1.6357100009918213', '1.5607099533081055', '1.6214300394058228', '1.571429967880249', '106613500.0', '1.506073236465454'], ['2010-01-21', '1.5821399688720703', '1.553570032119751', '1.571429967880249', '1.5642900466918945', '66865142.0', '1.499230146408081'], ['2010-01-22', '1.5607099533081055', '1.5035699605941772', '1.5571399927139282', '1.5321400165557861', '91190607.0', '1.4684172868728638'], ['2010-01-25', '1.524999976158142', '1.4964300394058228', '1.5214300155639648', '1.5', '58433757.0', '1.4376139640808105'], ['2010-01-26', '1.507140040397644', '1.428570032119751', '1.5', '1.4571399688720703', '74686721.0', '1.3965364694595337'], ['2010-01-27', '1.4642900228500366', '1.428570032119751', '1.4571399688720703', '1.4500000476837158', '49209558.0', '1.3896936178207397'], ['2010-01-28', '1.4678599834442139', '1.4392900466918945', '1.4500000476837158', '1.4571399688720703', '36010957.0', '1.3965364694595337'], ['2010-01-04', '8.130000114440918', '7.989999771118164', '8.109999656677246', '8.010000228881836', '13471969.0', '5.488150119781494'], ['2010-01-05', '8.09000015258789', '7.900000095367432', '8.029999732971191', '8.09000015258789', '12001396.0', '5.54296350479126'], ['2010-01-06', '8.140000343322754', '8.039999961853027', '8.100000381469727', '8.039999961853027', '13496984.0', '5.508705139160156'], ['2010-01-07', '8.020000457763672', '7.849999904632568', '8.020000457763672', '7.860000133514404', '10262641.0', '5.3853759765625'], ['2010-01-08', '7.860000133514404', '7.860000133514404', '7.860000133514404', '7.860000133514404', '0.0', '5.3853759765625'], ['2010-01-11', '7.860000133514404', '7.860000133514404', '7.860000133514404', '7.860000133514404', '0.0', '5.3853759765625'], ['2010-01-12', '7.860000133514404', '7.860000133514404', '7.860000133514404', '7.860000133514404', '0.0', '5.3853759765625'], ['2010-01-13', '7.860000133514404', '7.860000133514404', '7.860000133514404', '7.860000133514404', '0.0', '5.3853759765625'], ['2010-01-14', '7.860000133514404', '7.860000133514404', '7.860000133514404', '7.860000133514404', '0.0', '5.3853759765625'], ['2010-01-15', '7.860000133514404', '7.860000133514404', '7.860000133514404', '7.860000133514404', '0.0', '5.3853759765625'], ['2010-01-18', '8.34000015258789', '7.800000190734863', '7.829999923706055', '8.020000457763672', '20917280.0', '5.495001792907715'], ['2010-01-19', '8.109999656677246', '7.989999771118164', '8.039999961853027', '8.020000457763672', '14115371.0', '5.495001792907715'], ['2010-01-20', '8.050000190734863', '7.78000020980835', '8.020000457763672', '7.800000190734863', '13483884.0', '5.344265937805176'], ['2010-01-21', '7.860000133514404', '7.71999979019165', '7.800000190734863', '7.78000020980835', '8300195.0', '5.330562114715576'], ['2010-01-22', '7.809999942779541', '7.630000114440918', '7.75', '7.710000038146973', '7681392.0', '5.282601833343506'], ['2010-01-25', '7.800000190734863', '7.639999866485596', '7.679999828338623', '7.71999979019165', '5071674.0', '5.289453506469727'], ['2010-01-26', '7.739999771118164', '7.389999866485596', '7.71999979019165', '7.409999847412109', '6956304.0', '5.077053546905518'], ['2010-01-27', '7.489999771118164', '7.360000133514404', '7.409999847412109', '7.369999885559082', '4690595.0', '5.049646854400635'], ['2010-01-28', '7.429999828338623', '7.25', '7.400000095367432', '7.289999961853027', '7924234.0', '4.994833469390869'], ['2010-01-04', '5.96999979019165', '5.860000133514404', '5.96999979019165', '5.869999885559082', '4457081.0', '3.938664197921753'], ['2010-01-05', '5.909999847412109', '5.809999942779541', '5.880000114440918', '5.900000095367432', '4036819.0', '3.958794355392456'], ['2010-01-06', '5.960000038146973', '5.860000133514404', '5.900000095367432', '5.880000114440918', '4436603.0', '3.9453744888305664'], ['2010-01-07', '5.889999866485596', '5.730000019073486', '5.860000133514404', '5.760000228881836', '4516599.0', '3.864856719970703'], ['2010-01-08', '5.829999923706055', '5.730000019073486', '5.739999771118164', '5.809999942779541', '3889700.0', '3.898404836654663'], ['2010-01-11', '6.039999961853027', '5.800000190734863', '5.849999904632568', '6.03000020980835', '15850923.0', '4.046021938323975'], ['2010-01-12', '6.369999885559082', '5.989999771118164', '6.019999980926514', '6.309999942779541', '25963574.0', '4.233896255493164'], ['2010-01-13', '6.53000020980835', '6.239999771118164', '6.239999771118164', '6.28000020980835', '25576301.0', '4.2137675285339355'], ['2010-01-14', '6.420000076293945', '6.21999979019165', '6.360000133514404', '6.329999923706055', '11431174.0', '4.247316360473633'], ['2010-01-15', '6.349999904632568', '6.239999771118164', '6.300000190734863', '6.309999942779541', '7707084.0', '4.233896255493164'], ['2010-01-18', '6.550000190734863', '6.230000019073486', '6.300000190734863', '6.510000228881836', '16247472.0', '4.368093013763428'], ['2010-01-19', '7.159999847412109', '6.449999809265137', '6.510000228881836', '7.159999847412109', '39701483.0', '4.804232120513916'], ['2010-01-20', '7.880000114440918', '7.349999904632568', '7.349999904632568', '7.880000114440918', '127174906.0', '5.2873382568359375'], ['2010-01-21', '7.75', '7.199999809265137', '7.699999809265137', '7.519999980926514', '69143612.0', '5.045784950256348'], ['2010-01-22', '8.15999984741211', '7.53000020980835', '7.579999923706055', '7.619999885559082', '81485220.0', '5.1128830909729'], ['2010-01-25', '7.449999809265137', '7.099999904632568', '7.300000190734863', '7.159999847412109', '32671736.0', '4.804232120513916'], ['2010-01-26', '7.289999961853027', '6.5', '7.159999847412109', '6.760000228881836', '31443993.0', '4.535838603973389'], ['2010-01-27', '7.059999942779541', '6.519999980926514', '6.659999847412109', '6.820000171661377', '34603457.0', '4.57609748840332'], ['2010-01-28', '7.349999904632568', '6.659999847412109', '6.679999828338623', '7.320000171661377', '37295526.0', '4.911588668823242'], ['2010-01-04', '6.714739799499512', '6.543799877166748', '6.629270076751709', '6.559830188751221', '84191152.0', '4.2687907218933105'], ['2010-01-05', '6.752140045166016', '6.463679790496826', '6.60791015625', '6.725430011749268', '110703114.0', '4.376554489135742'], ['2010-01-06', '6.704060077667236', '6.469019889831543', '6.693379878997803', '6.479700088500977', '101824254.0', '4.216646194458008'], ['2010-01-07', '6.543799877166748', '6.3140997886657715', '6.479700088500977', '6.346149921417236', '95875566.0', '4.129738807678223'], ['2010-01-08', '6.431620121002197', '6.25', '6.303420066833496', '6.388889789581299', '53191613.0', '4.1575517654418945'], ['2010-01-11', '6.677350044250488', '6.415599822998047', '6.613249778747559', '6.442309856414795', '97118276.0', '4.192315101623535'], ['2010-01-12', '6.661320209503174', '6.2927398681640625', '6.410260200500488', '6.629270076751709', '91346009.0', '4.313979148864746'], ['2010-01-13', '6.47435998916626', '6.143159866333008', '6.410260200500488', '6.191239833831787', '136231818.0', '4.0289306640625'], ['2010-01-14', '6.244659900665283', '6.079060077667236', '6.2072601318359375', '6.196579933166504', '65020622.0', '4.032406806945801'], ['2010-01-15', '6.282050132751465', '6.137819766998291', '6.1859002113342285', '6.191239833831787', '53218633.0', '4.0289306640625'], ['2010-01-18', '6.180560111999512', '6.079060077667236', '6.1591901779174805', '6.148499965667725', '55010030.0', '4.0011186599731445'], ['2010-01-19', '6.255340099334717', '6.137819766998291', '6.175209999084473', '6.169869899749756', '50164823.0', '4.0150251388549805'], ['2010-01-20', '6.212609767913818', '5.876070022583008', '6.1859002113342285', '5.908120155334473', '68328187.0', '3.8446922302246094'], ['2010-01-21', '6.143159866333008', '5.886750221252441', '5.886750221252441', '6.079060077667236', '67374888.0', '3.9559309482574463'], ['2010-01-22', '6.3408098220825195', '5.945509910583496', '5.98291015625', '6.2660298347473145', '111889562.0', '4.077601432800293'], ['2010-01-25', '6.287390232086182', '6.127140045166016', '6.148499965667725', '6.143159866333008', '46498007.0', '3.9976444244384766'], ['2010-01-04', '4.716430187225342', '4.583330154418945', '4.646989822387695', '4.589119911193848', '420887466.0', '2.9446263313293457'], ['2010-01-05', '4.7106499671936035', '4.513889789581299', '4.623839855194092', '4.670139789581299', '397762846.0', '2.996613025665283'], ['2010-01-06', '4.675930023193359', '4.571760177612305', '4.646989822387695', '4.577549934387207', '279384090.0', '2.937202215194702'], ['2010-01-07', '4.583330154418945', '4.427080154418945', '4.571760177612305', '4.456019878387451', '287722658.0', '2.859222173690796'], ['2010-01-08', '4.519680023193359', '4.421299934387207', '4.450230121612549', '4.502309799194336', '203065401.0', '2.8889243602752686'], ['2010-01-11', '4.751160144805908', '4.513889789581299', '4.716430187225342', '4.5543999671936035', '446305394.0', '2.9223475456237793'], ['2010-01-12', '4.606480121612549', '4.3981499671936035', '4.5254597663879395', '4.577549934387207', '316389327.0', '2.937202215194702'], ['2010-01-13', '4.473380088806152', '4.340280055999756', '4.427080154418945', '4.375', '500350462.0', '2.8072350025177'], ['2010-01-14', '4.403940200805664', '4.311339855194092', '4.3981499671936035', '4.3807902336120605', '250090571.0', '2.810950517654419'], ['2010-01-15', '4.421299934387207', '4.317130088806152', '4.386569976806641', '4.3807902336120605', '200494565.0', '2.810950517654419'], ['2010-01-18', '4.403940200805664', '4.340280055999756', '4.346059799194336', '4.392360210418701', '195516441.0', '2.8183746337890625'], ['2010-01-19', '4.484950065612793', '4.403940200805664', '4.403940200805664', '4.461810111999512', '266631853.0', '2.8629374504089355'], ['2010-01-20', '4.479169845581055', '4.317130088806152', '4.473380088806152', '4.340280055999756', '217100028.0', '2.78495717048645'], ['2010-01-21', '4.456019878387451', '4.334489822387695', '4.346059799194336', '4.415510177612305', '206920647.0', '2.833228826522827'], ['2010-01-22', '4.583330154418945', '4.328700065612793', '4.3518500328063965', '4.502309799194336', '478445910.0', '2.8889243602752686'], ['2010-01-25', '4.542819976806641', '4.3981499671936035', '4.427080154418945', '4.415510177612305', '210411535.0', '2.833228826522827'], ['2010-01-26', '4.479169845581055', '4.340280055999756', '4.409719944000244', '4.3692097663879395', '195809873.0', '2.8035202026367188'], ['2010-01-27', '4.415510177612305', '4.2129597663879395', '4.3807902336120605', '4.236110210418701', '206082627.0', '2.71811580657959'], ['2010-01-28', '4.259260177612305', '4.166669845581055', '4.253469944000244', '4.1956000328063965', '176181287.0', '2.6921229362487793']]

查看输出,发现所有数据合并到一起后,丢失了股票名的信息,所以在合并时,要加入股票名或股票代码的信息:

import os


def get_list(pathname):
    """接收路径名为参数,返回路径下的文件名列表"""
    return os.listdir(pathname)[:-1]  # [:-1]返回去除最后一个文件的列表,去掉 '沪市股票top300.csv'


def merge_data(name_ls):
    """接收文件名为列表,返回二维列表"""
    stock_data = []
    for filename in name_ls:
        with open(path + filename) as file_obj:
            title = file_obj.readline()  # 读取第一行,标题行,返回字符串
            title = ['stock_code'] + title.strip().split(',')  # 为标题行增加股票代码

            for line in file_obj:  # 遍历文件剩余行
                data = line.strip().split(',')  # 当前行数据切分为列表
                data_with_code = [filename[:-4]] + data  # 股票代码增加到数据中./sample/600000.csv,切取代码如“600000”
                stock_data.append(data_with_code)  # 每行列表,增加到二维列表中
    return [title] + stock_data    # 标题行做为二维列表中的第一个元素



if __name__ == '__main__':
    path = '.\sample\'  # 源文件路径
    new_file = '合并的股票数据.csv'
    name_list = get_list(path)
    stock_info = merge_data(name_list)
    print(stock_info)

运行的结果是:

[['stock_code', 'Date', 'High', 'Low', 'Open', 'Close', 'Volume', 'Adj Close'], ['600000', '2010-01-04', '9.049530029296875', '8.75574016571045', '9.032979965209961', '8.768150329589844', '159964607.0', '5.441317081451416'], ['600000', '2010-01-05', '8.929530143737793', '8.602640151977539', '8.859189987182617', '8.834360122680664', '278278034.0', '5.4824042320251465'], ['600000', '2010-01-06', '8.81367015838623', '8.639880180358887', '8.809530258178711', '8.66057014465332', '233894449.0', '5.3745551109313965'], ['600000', '2010-01-07', '8.706089973449707', '8.399880409240723', '8.639880180358887', '8.466090202331543', '205990015.0', '5.253864765167236'], ['600000', '2010-01-08', '8.606780052185059', '8.399880409240723', '8.4164400100708', '8.561260223388672', '158795668.0', '5.312924861907959'], ['600000', '2010-01-11', '9.020569801330566', '8.51161003112793', '8.937809944152832', '8.561260223388672', '281073839.0', '5.312924861907959'], ['600000', '2010-01-12', '8.677120208740234', '8.383330345153809', '8.536430358886719', '8.606780052185059', '199017998.0', '5.34117317199707'], ['600000', '2010-01-13', '8.420570373535156', '8.19299030303955', '8.379190444946289', '8.205400466918945', '353804116.0', '5.092085838317871'], ['600000', '2010-01-14', '8.28402042388916', '8.126779556274414', '8.221960067749023', '8.263330459594727', '186909441.0', '5.1280364990234375'], ['600000', '2010-01-15', '8.379190444946289', '8.159890174865723', '8.28402042388916', '8.2923002243042', '167196170.0', '5.146015167236328'], ['600000', '2010-01-18', '8.395750045776367', '8.221960067749023', '8.238510131835938', '8.375060081481934', '169024525.0', '5.197373867034912'], ['600000', '2010-01-19', '8.519880294799805', '8.362640380859375', '8.379190444946289', '8.420570373535156', '169087168.0', '5.225615978240967'], ['600000', '2010-01-20', '8.495059967041016', '8.110230445861816', '8.449540138244629', '8.188850402832031', '195212592.0', '5.081815719604492'], ['600000', '2010-01-21', '8.51161003112793', '8.176440238952637', '8.226090431213379', '8.470230102539062', '225763730.0', '5.256433963775635'], ['600000', '2010-01-22', '8.730910301208496', '8.279890060424805', '8.35851001739502', '8.648159980773926', '373249590.0', '5.3668532371521'], ['600000', '2010-01-25', '8.681260108947754', '8.449540138244629', '8.50747013092041', '8.466090202331543', '193898427.0', '5.253864765167236'], ['600000', '2010-01-26', '8.648159980773926', '8.346090316772461', '8.478500366210938', '8.561260223388672', '222183082.0', '5.312924861907959'], ['600000', '2010-01-27', '8.606780052185059', '8.184709548950195', '8.552989959716797', '8.217820167541504', '227808686.0', '5.099793910980225'], ['600000', '2010-01-28', '8.213680267333984', '8.019200325012207', '8.184709548950195', '8.151610374450684', '141840241.0', '5.058705806732178'], ['600004', '2010-01-04', '7.089660167694092', '6.993100166320801', '7.0', '7.0', '22444338.0', '4.525339603424072'], ['600004', '2010-01-05', '7.062069892883301', '6.993100166320801', '7.0', '7.027589797973633', '16052837.0', '4.543176174163818'], ['600004', '2010-01-06', '7.027589797973633', '6.910339832305908', '7.013790130615234', '6.924139976501465', '13645464.0', '4.476297378540039'], ['600004', '2010-01-07', '6.931029796600342', '6.696549892425537', '6.896550178527832', '6.744830131530762', '12994629.0', '4.360378742218018'], ['600004', '2010-01-08', '7.068970203399658', '6.7103400230407715', '6.7103400230407715', '7.020689964294434', '21639527.0', '4.538715362548828'], ['600004', '2010-01-11', '7.213789939880371', '7.020689964294434', '7.075860023498535', '7.165520191192627', '31004200.0', '4.6323442459106445'], ['600004', '2010-01-12', '7.22068977355957', '7.068970203399658', '7.124139785766602', '7.213789939880371', '18696800.0', '4.663549423217773'], ['600004', '2010-01-13', '7.241380214691162', '7.041379928588867', '7.075860023498535', '7.110340118408203', '20884404.0', '4.5966715812683105'], ['600004', '2010-01-14', '7.400000095367432', '7.089660167694092', '7.103449821472168', '7.365520000457764', '26863236.0', '4.761639595031738'], ['600004', '2010-01-15', '7.400000095367432', '7.262070178985596', '7.3586201667785645', '7.31033992767334', '14603810.0', '4.7259674072265625'], ['600004', '2010-01-18', '7.6413798332214355', '7.241380214691162', '7.31033992767334', '7.558619976043701', '27816184.0', '4.886474609375'], ['600004', '2010-01-19', '7.724140167236328', '7.482759952545166', '7.517240047454834', '7.65516996383667', '29316690.0', '4.948891639709473'], ['600004', '2010-01-20', '7.696549892425537', '7.510340213775635', '7.668970108032227', '7.579309940338135', '28765702.0', '4.899850368499756'], ['600004', '2010-01-21', '7.827589988708496', '7.448279857635498', '7.758619785308838', '7.475860118865967', '28196748.0', '4.832971572875977'], ['600004', '2010-01-22', '7.986209869384766', '7.455170154571533', '7.517240047454834', '7.6413798332214355', '58896409.0', '4.939977169036865'], ['600004', '2010-01-25', '7.77931022644043', '7.303450107574463', '7.662069797515869', '7.317240238189697', '29152040.0', '4.730428218841553'], ['600004', '2010-01-26', '7.400000095367432', '7.034480094909668', '7.317240238189697', '7.165520191192627', '21009601.0', '4.6323442459106445'], ['600004', '2010-01-27', '7.234479904174805', '7.041379928588867', '7.172410011291504', '7.089660167694092', '11260503.0', '4.583302021026611'], ['600004', '2010-01-28', '7.400000095367432', '7.034480094909668', '7.089660167694092', '7.386209964752197', '22893367.0', '4.775014877319336'], ['600006', '2010-01-04', '7.070000171661377', '6.900000095367432', '6.929999828338623', '6.909999847412109', '23281430.0', '6.176186561584473'], ['600006', '2010-01-05', '6.940000057220459', '6.75', '6.909999847412109', '6.869999885559082', '16569457.0', '6.140435695648193'], ['600006', '2010-01-06', '7.03000020980835', '6.809999942779541', '6.869999885559082', '6.889999866485596', '21867767.0', '6.158311367034912'], ['600006', '2010-01-07', '6.880000114440918', '6.539999961853027', '6.849999904632568', '6.559999942779541', '27696059.0', '5.86335563659668'], ['600006', '2010-01-08', '6.630000114440918', '6.480000019073486', '6.559999942779541', '6.619999885559082', '12747269.0', '5.916983127593994'], ['600006', '2010-01-11', '6.739999771118164', '6.5', '6.659999847412109', '6.519999980926514', '13057756.0', '5.827603340148926'], ['600006', '2010-01-12', '6.679999828338623', '6.5', '6.570000171661377', '6.679999828338623', '15268352.0', '5.970611095428467'], ['600006', '2010-01-13', '6.610000133514404', '6.489999771118164', '6.590000152587891', '6.519999980926514', '14191042.0', '5.827603340148926'], ['600006', '2010-01-14', '6.639999866485596', '6.519999980926514', '6.519999980926514', '6.619999885559082', '13557759.0', '5.916983127593994'], ['600006', '2010-01-15', '6.789999961853027', '6.599999904632568', '6.619999885559082', '6.739999771118164', '18139223.0', '6.024240016937256'], ['600006', '2010-01-18', '6.820000171661377', '6.659999847412109', '6.789999961853027', '6.760000228881836', '14608947.0', '6.042116641998291'], ['600006', '2010-01-19', '6.820000171661377', '6.639999866485596', '6.820000171661377', '6.679999828338623', '17516772.0', '5.970611095428467'], ['600006', '2010-01-20', '6.800000190734863', '6.550000190734863', '6.679999828338623', '6.579999923706055', '25474831.0', '5.881231307983398'], ['600006', '2010-01-21', '6.900000095367432', '6.690000057220459', '6.760000228881836', '6.760000228881836', '36100876.0', '6.042116641998291'], ['600006', '2010-01-22', '6.650000095367432', '6.320000171661377', '6.650000095367432', '6.400000095367432', '28445190.0', '5.720346927642822'], ['600006', '2010-01-25', '6.389999866485596', '6.190000057220459', '6.340000152587891', '6.199999809265137', '12549070.0', '5.541585445404053'], ['600006', '2010-01-26', '6.28000020980835', '5.880000114440918', '6.210000038146973', '5.900000095367432', '12855146.0', '5.273444175720215'], ['600006', '2010-01-27', '5.980000019073486', '5.699999809265137', '5.900000095367432', '5.710000038146973', '17086828.0', '5.103621482849121'], ['600006', '2010-01-28', '5.800000190734863', '5.619999885559082', '5.690000057220459', '5.769999980926514', '9583801.0', '5.157249450683594'], ['600007', '2010-01-04', '12.399999618530273', '11.829999923706055', '12.399999618530273', '11.859999656677246', '5257993.0', '9.957270622253418'], ['600007', '2010-01-05', '11.930000305175781', '11.380000114440918', '11.859999656677246', '11.479999542236328', '6131146.0', '9.63823413848877'], ['600007', '2010-01-06', '11.670000076293945', '11.479999542236328', '11.489999771118164', '11.59000015258789', '3659270.0', '9.73058795928955'], ['600007', '2010-01-07', '11.819999694824219', '11.550000190734863', '11.600000381469727', '11.739999771118164', '4344484.0', '9.856523513793945'], ['600007', '2010-01-08', '11.739999771118164', '11.430000305175781', '11.649999618530273', '11.630000114440918', '4826947.0', '9.764169692993164'], ['600007', '2010-01-11', '11.779999732971191', '11.050000190734863', '11.710000038146973', '11.3100004196167', '7622395.0', '9.49551010131836'], ['600007', '2010-01-12', '11.350000381469727', '10.90999984741211', '11.289999961853027', '11.329999923706055', '5886011.0', '9.512300491333008'], ['600007', '2010-01-13', '11.109999656677246', '10.90999984741211', '11.109999656677246', '10.949999809265137', '4733046.0', '9.19326400756836'], ['600007', '2010-01-14', '11.130000114440918', '10.930000305175781', '11.0', '11.109999656677246', '3725035.0', '9.327594757080078'], ['600007', '2010-01-15', '11.34000015258789', '11.09000015258789', '11.119999885559082', '11.199999809265137', '5977276.0', '9.403157234191895'], ['600007', '2010-01-18', '11.289999961853027', '11.130000114440918', '11.180000305175781', '11.279999732971191', '6654531.0', '9.470320701599121'], ['600007', '2010-01-19', '11.380000114440918', '11.25', '11.279999732971191', '11.300000190734863', '4918996.0', '9.487113952636719'], ['600007', '2010-01-20', '11.350000381469727', '10.8100004196167', '11.34000015258789', '10.819999694824219', '4827128.0', '9.084121704101562'], ['600007', '2010-01-21', '10.899999618530273', '10.710000038146973', '10.829999923706055', '10.850000381469727', '2787098.0', '9.109307289123535'], ['600007', '2010-01-22', '10.760000228881836', '10.359999656677246', '10.760000228881836', '10.5', '3665314.0', '8.815459251403809'], ['600007', '2010-01-25', '10.800000190734863', '10.359999656677246', '10.460000038146973', '10.699999809265137', '2584601.0', '8.983370780944824'], ['600007', '2010-01-26', '10.699999809265137', '10.449999809265137', '10.649999618530273', '10.65999984741211', '2482257.0', '8.949789047241211'], ['600007', '2010-01-27', '10.869999885559082', '10.449999809265137', '10.600000381469727', '10.850000381469727', '4022402.0', '9.109307289123535'], ['600007', '2010-01-28', '11.0', '10.600000381469727', '10.800000190734863', '11.0', '6071121.0', '9.23524284362793'], ['600008', '2010-01-04', '3.6500000953674316', '3.565000057220459', '3.634999990463257', '3.575000047683716', '28141264.0', '2.5811192989349365'], ['600008', '2010-01-05', '3.5899999141693115', '3.515000104904175', '3.5799999237060547', '3.565000057220459', '37961332.0', '2.573899269104004'], ['600008', '2010-01-06', '3.6649999618530273', '3.5950000286102295', '3.5950000286102295', '3.5999999046325684', '48343282.0', '2.5991690158843994'], ['600008', '2010-01-07', '3.609999895095825', '3.515000104904175', '3.609999895095825', '3.5250000953674316', '30403996.0', '2.5450193881988525'], ['600008', '2010-01-08', '3.555000066757202', '3.494999885559082', '3.5', '3.549999952316284', '24959566.0', '2.5630693435668945'], ['600008', '2010-01-11', '3.5999999046325684', '3.4700000286102295', '3.569999933242798', '3.5250000953674316', '38739902.0', '2.5450193881988525'], ['600008', '2010-01-12', '3.5999999046325684', '3.494999885559082', '3.5350000858306885', '3.5999999046325684', '41444678.0', '2.5991690158843994'], ['600008', '2010-01-13', '3.619999885559082', '3.5250000953674316', '3.5299999713897705', '3.5299999713897705', '34469714.0', '2.5486292839050293'], ['600008', '2010-01-14', '3.619999885559082', '3.5299999713897705', '3.5450000762939453', '3.609999895095825', '40375736.0', '2.606388807296753'], ['600008', '2010-01-15', '3.6700000762939453', '3.5950000286102295', '3.634999990463257', '3.6500000953674316', '61858412.0', '2.635268449783325'], ['600008', '2010-01-18', '3.740000009536743', '3.619999885559082', '3.6649999618530273', '3.7300000190734863', '59658852.0', '2.6930277347564697'], ['600008', '2010-01-19', '3.765000104904175', '3.674999952316284', '3.75', '3.694999933242798', '43811408.0', '2.6677582263946533'], ['600008', '2010-01-20', '3.759999990463257', '3.630000114440918', '3.7049999237060547', '3.6600000858306885', '63839868.0', '2.6424882411956787'], ['600008', '2010-01-21', '3.7300000190734863', '3.615000009536743', '3.6649999618530273', '3.694999933242798', '47452994.0', '2.6677582263946533'], ['600008', '2010-01-22', '3.694999933242798', '3.509999990463257', '3.625', '3.549999952316284', '47527890.0', '2.5630693435668945'], ['600008', '2010-01-25', '3.575000047683716', '3.5', '3.505000114440918', '3.505000114440918', '21810998.0', '2.5305800437927246'], ['600008', '2010-01-26', '3.5299999713897705', '3.299999952316284', '3.5299999713897705', '3.3350000381469727', '39234732.0', '2.407841205596924'], ['600008', '2010-01-27', '3.365000009536743', '3.25', '3.3399999141693115', '3.2699999809265137', '28790360.0', '2.3609116077423096'], ['600008', '2010-01-28', '3.3299999237060547', '3.2799999713897705', '3.2799999713897705', '3.319999933242798', '17576242.0', '2.3970110416412354'], ['600009', '2010-01-04', '18.25', '17.450000762939453', '17.450000762939453', '17.899999618530273', '47821206.0', '15.014424324035645'], ['600009', '2010-01-05', '18.280000686645508', '17.809999465942383', '17.899999618530273', '18.020000457763672', '25767982.0', '15.115082740783691'], ['600009', '2010-01-06', '18.049999237060547', '17.600000381469727', '18.0', '17.700000762939453', '19371487.0', '14.846667289733887'], ['600009', '2010-01-07', '17.959999084472656', '17.459999084472656', '17.600000381469727', '17.520000457763672', '22599261.0', '14.695682525634766'], ['600009', '2010-01-08', '18.299999237060547', '17.350000381469727', '17.40999984741211', '17.940000534057617', '28840870.0', '15.047977447509766'], ['600009', '2010-01-11', '18.68000030517578', '17.889999389648438', '18.299999237060547', '18.190000534057617', '35598501.0', '15.257675170898438'], ['600009', '2010-01-12', '18.309999465942383', '17.8799991607666', '18.190000534057617', '18.059999465942383', '32283334.0', '15.148630142211914'], ['600009', '2010-01-13', '18.790000915527344', '17.579999923706055', '17.6299991607666', '18.40999984741211', '44525929.0', '15.442209243774414'], ['600009', '2010-01-14', '19.469999313354492', '18.280000686645508', '18.450000762939453', '19.290000915527344', '37892359.0', '16.180349349975586'], ['600009', '2010-01-15', '19.40999984741211', '19.0', '19.260000228881836', '19.1200008392334', '17932939.0', '16.037755966186523'], ['600009', '2010-01-18', '21.0', '19.170000076293945', '19.18000030517578', '20.510000228881836', '52589069.0', '17.20368003845215'], ['600009', '2010-01-19', '20.729999542236328', '20.209999084472656', '20.56999969482422', '20.56999969482422', '31242861.0', '17.254011154174805'], ['600009', '2010-01-20', '20.540000915527344', '19.530000686645508', '20.540000915527344', '19.68000030517578', '34882325.0', '16.507478713989258'], ['600009', '2010-01-21', '20.450000762939453', '19.299999237060547', '19.690000534057617', '19.719999313354492', '33745950.0', '16.541030883789062'], ['600009', '2010-01-22', '20.1200008392334', '19.0', '19.59000015258789', '19.31999969482422', '38415756.0', '16.20551109313965'], ['600009', '2010-01-25', '19.280000686645508', '18.399999618530273', '19.280000686645508', '18.479999542236328', '26530113.0', '15.500926971435547'], ['600009', '2010-01-26', '18.700000762939453', '17.860000610351562', '18.40999984741211', '18.559999465942383', '31250551.0', '15.568026542663574'], ['600009', '2010-01-27', '18.649999618530273', '18.040000915527344', '18.399999618530273', '18.18000030517578', '18448373.0', '15.249288558959961'], ['600009', '2010-01-28', '18.549999237060547', '18.100000381469727', '18.149999618530273', '18.549999237060547', '17711697.0', '15.559640884399414'], ['600010', '2010-01-04', '1.664289951324463', '1.6357100009918213', '1.6607099771499634', '1.6357100009918213', '87618140.0', '1.5676798820495605'], ['600010', '2010-01-05', '1.6428600549697876', '1.600000023841858', '1.6357100009918213', '1.6285699605941772', '96975623.0', '1.560836672782898'], ['600010', '2010-01-06', '1.6571400165557861', '1.6071399450302124', '1.625', '1.632140040397644', '101696090.0', '1.5642582178115845'], ['600010', '2010-01-07', '1.632140040397644', '1.5892900228500366', '1.632140040397644', '1.5928599834442139', '88698358.0', '1.5266119241714478'], ['600010', '2010-01-08', '1.6071399450302124', '1.571429967880249', '1.5928599834442139', '1.600000023841858', '83714400.0', '1.5334550142288208'], ['600010', '2010-01-11', '1.6392899751663208', '1.5892900228500366', '1.632140040397644', '1.5928599834442139', '62564902.0', '1.5266119241714478'], ['600010', '2010-01-12', '1.617859959602356', '1.5750000476837158', '1.5750000476837158', '1.6142899990081787', '69193312.0', '1.5471504926681519'], ['600010', '2010-01-13', '1.600000023841858', '1.5750000476837158', '1.5928599834442139', '1.578570008277893', '91232425.0', '1.5129163265228271'], ['600010', '2010-01-14', '1.5964299440383911', '1.5750000476837158', '1.578570008277893', '1.5928599834442139', '63042263.0', '1.5266119241714478'], ['600010', '2010-01-15', '1.5964299440383911', '1.571429967880249', '1.5928599834442139', '1.5928599834442139', '70785467.0', '1.5266119241714478'], ['600010', '2010-01-18', '1.5964299440383911', '1.571429967880249', '1.585710048675537', '1.5928599834442139', '72970103.0', '1.5266119241714478'], ['600010', '2010-01-19', '1.6285699605941772', '1.585710048675537', '1.5928599834442139', '1.6214300394058228', '136309846.0', '1.553993582725525'], ['600010', '2010-01-20', '1.6357100009918213', '1.5607099533081055', '1.6214300394058228', '1.571429967880249', '106613500.0', '1.506073236465454'], ['600010', '2010-01-21', '1.5821399688720703', '1.553570032119751', '1.571429967880249', '1.5642900466918945', '66865142.0', '1.499230146408081'], ['600010', '2010-01-22', '1.5607099533081055', '1.5035699605941772', '1.5571399927139282', '1.5321400165557861', '91190607.0', '1.4684172868728638'], ['600010', '2010-01-25', '1.524999976158142', '1.4964300394058228', '1.5214300155639648', '1.5', '58433757.0', '1.4376139640808105'], ['600010', '2010-01-26', '1.507140040397644', '1.428570032119751', '1.5', '1.4571399688720703', '74686721.0', '1.3965364694595337'], ['600010', '2010-01-27', '1.4642900228500366', '1.428570032119751', '1.4571399688720703', '1.4500000476837158', '49209558.0', '1.3896936178207397'], ['600010', '2010-01-28', '1.4678599834442139', '1.4392900466918945', '1.4500000476837158', '1.4571399688720703', '36010957.0', '1.3965364694595337'], ['600011', '2010-01-04', '8.130000114440918', '7.989999771118164', '8.109999656677246', '8.010000228881836', '13471969.0', '5.488150119781494'], ['600011', '2010-01-05', '8.09000015258789', '7.900000095367432', '8.029999732971191', '8.09000015258789', '12001396.0', '5.54296350479126'], ['600011', '2010-01-06', '8.140000343322754', '8.039999961853027', '8.100000381469727', '8.039999961853027', '13496984.0', '5.508705139160156'], ['600011', '2010-01-07', '8.020000457763672', '7.849999904632568', '8.020000457763672', '7.860000133514404', '10262641.0', '5.3853759765625'], ['600011', '2010-01-08', '7.860000133514404', '7.860000133514404', '7.860000133514404', '7.860000133514404', '0.0', '5.3853759765625'], ['600011', '2010-01-11', '7.860000133514404', '7.860000133514404', '7.860000133514404', '7.860000133514404', '0.0', '5.3853759765625'], ['600011', '2010-01-12', '7.860000133514404', '7.860000133514404', '7.860000133514404', '7.860000133514404', '0.0', '5.3853759765625'], ['600011', '2010-01-13', '7.860000133514404', '7.860000133514404', '7.860000133514404', '7.860000133514404', '0.0', '5.3853759765625'], ['600011', '2010-01-14', '7.860000133514404', '7.860000133514404', '7.860000133514404', '7.860000133514404', '0.0', '5.3853759765625'], ['600011', '2010-01-15', '7.860000133514404', '7.860000133514404', '7.860000133514404', '7.860000133514404', '0.0', '5.3853759765625'], ['600011', '2010-01-18', '8.34000015258789', '7.800000190734863', '7.829999923706055', '8.020000457763672', '20917280.0', '5.495001792907715'], ['600011', '2010-01-19', '8.109999656677246', '7.989999771118164', '8.039999961853027', '8.020000457763672', '14115371.0', '5.495001792907715'], ['600011', '2010-01-20', '8.050000190734863', '7.78000020980835', '8.020000457763672', '7.800000190734863', '13483884.0', '5.344265937805176'], ['600011', '2010-01-21', '7.860000133514404', '7.71999979019165', '7.800000190734863', '7.78000020980835', '8300195.0', '5.330562114715576'], ['600011', '2010-01-22', '7.809999942779541', '7.630000114440918', '7.75', '7.710000038146973', '7681392.0', '5.282601833343506'], ['600011', '2010-01-25', '7.800000190734863', '7.639999866485596', '7.679999828338623', '7.71999979019165', '5071674.0', '5.289453506469727'], ['600011', '2010-01-26', '7.739999771118164', '7.389999866485596', '7.71999979019165', '7.409999847412109', '6956304.0', '5.077053546905518'], ['600011', '2010-01-27', '7.489999771118164', '7.360000133514404', '7.409999847412109', '7.369999885559082', '4690595.0', '5.049646854400635'], ['600011', '2010-01-28', '7.429999828338623', '7.25', '7.400000095367432', '7.289999961853027', '7924234.0', '4.994833469390869'], ['600012', '2010-01-04', '5.96999979019165', '5.860000133514404', '5.96999979019165', '5.869999885559082', '4457081.0', '3.938664197921753'], ['600012', '2010-01-05', '5.909999847412109', '5.809999942779541', '5.880000114440918', '5.900000095367432', '4036819.0', '3.958794355392456'], ['600012', '2010-01-06', '5.960000038146973', '5.860000133514404', '5.900000095367432', '5.880000114440918', '4436603.0', '3.9453744888305664'], ['600012', '2010-01-07', '5.889999866485596', '5.730000019073486', '5.860000133514404', '5.760000228881836', '4516599.0', '3.864856719970703'], ['600012', '2010-01-08', '5.829999923706055', '5.730000019073486', '5.739999771118164', '5.809999942779541', '3889700.0', '3.898404836654663'], ['600012', '2010-01-11', '6.039999961853027', '5.800000190734863', '5.849999904632568', '6.03000020980835', '15850923.0', '4.046021938323975'], ['600012', '2010-01-12', '6.369999885559082', '5.989999771118164', '6.019999980926514', '6.309999942779541', '25963574.0', '4.233896255493164'], ['600012', '2010-01-13', '6.53000020980835', '6.239999771118164', '6.239999771118164', '6.28000020980835', '25576301.0', '4.2137675285339355'], ['600012', '2010-01-14', '6.420000076293945', '6.21999979019165', '6.360000133514404', '6.329999923706055', '11431174.0', '4.247316360473633'], ['600012', '2010-01-15', '6.349999904632568', '6.239999771118164', '6.300000190734863', '6.309999942779541', '7707084.0', '4.233896255493164'], ['600012', '2010-01-18', '6.550000190734863', '6.230000019073486', '6.300000190734863', '6.510000228881836', '16247472.0', '4.368093013763428'], ['600012', '2010-01-19', '7.159999847412109', '6.449999809265137', '6.510000228881836', '7.159999847412109', '39701483.0', '4.804232120513916'], ['600012', '2010-01-20', '7.880000114440918', '7.349999904632568', '7.349999904632568', '7.880000114440918', '127174906.0', '5.2873382568359375'], ['600012', '2010-01-21', '7.75', '7.199999809265137', '7.699999809265137', '7.519999980926514', '69143612.0', '5.045784950256348'], ['600012', '2010-01-22', '8.15999984741211', '7.53000020980835', '7.579999923706055', '7.619999885559082', '81485220.0', '5.1128830909729'], ['600012', '2010-01-25', '7.449999809265137', '7.099999904632568', '7.300000190734863', '7.159999847412109', '32671736.0', '4.804232120513916'], ['600012', '2010-01-26', '7.289999961853027', '6.5', '7.159999847412109', '6.760000228881836', '31443993.0', '4.535838603973389'], ['600012', '2010-01-27', '7.059999942779541', '6.519999980926514', '6.659999847412109', '6.820000171661377', '34603457.0', '4.57609748840332'], ['600012', '2010-01-28', '7.349999904632568', '6.659999847412109', '6.679999828338623', '7.320000171661377', '37295526.0', '4.911588668823242'], ['600015', '2010-01-04', '6.714739799499512', '6.543799877166748', '6.629270076751709', '6.559830188751221', '84191152.0', '4.2687907218933105'], ['600015', '2010-01-05', '6.752140045166016', '6.463679790496826', '6.60791015625', '6.725430011749268', '110703114.0', '4.376554489135742'], ['600015', '2010-01-06', '6.704060077667236', '6.469019889831543', '6.693379878997803', '6.479700088500977', '101824254.0', '4.216646194458008'], ['600015', '2010-01-07', '6.543799877166748', '6.3140997886657715', '6.479700088500977', '6.346149921417236', '95875566.0', '4.129738807678223'], ['600015', '2010-01-08', '6.431620121002197', '6.25', '6.303420066833496', '6.388889789581299', '53191613.0', '4.1575517654418945'], ['600015', '2010-01-11', '6.677350044250488', '6.415599822998047', '6.613249778747559', '6.442309856414795', '97118276.0', '4.192315101623535'], ['600015', '2010-01-12', '6.661320209503174', '6.2927398681640625', '6.410260200500488', '6.629270076751709', '91346009.0', '4.313979148864746'], ['600015', '2010-01-13', '6.47435998916626', '6.143159866333008', '6.410260200500488', '6.191239833831787', '136231818.0', '4.0289306640625'], ['600015', '2010-01-14', '6.244659900665283', '6.079060077667236', '6.2072601318359375', '6.196579933166504', '65020622.0', '4.032406806945801'], ['600015', '2010-01-15', '6.282050132751465', '6.137819766998291', '6.1859002113342285', '6.191239833831787', '53218633.0', '4.0289306640625'], ['600015', '2010-01-18', '6.180560111999512', '6.079060077667236', '6.1591901779174805', '6.148499965667725', '55010030.0', '4.0011186599731445'], ['600015', '2010-01-19', '6.255340099334717', '6.137819766998291', '6.175209999084473', '6.169869899749756', '50164823.0', '4.0150251388549805'], ['600015', '2010-01-20', '6.212609767913818', '5.876070022583008', '6.1859002113342285', '5.908120155334473', '68328187.0', '3.8446922302246094'], ['600015', '2010-01-21', '6.143159866333008', '5.886750221252441', '5.886750221252441', '6.079060077667236', '67374888.0', '3.9559309482574463'], ['600015', '2010-01-22', '6.3408098220825195', '5.945509910583496', '5.98291015625', '6.2660298347473145', '111889562.0', '4.077601432800293'], ['600015', '2010-01-25', '6.287390232086182', '6.127140045166016', '6.148499965667725', '6.143159866333008', '46498007.0', '3.9976444244384766'], ['600016', '2010-01-04', '4.716430187225342', '4.583330154418945', '4.646989822387695', '4.589119911193848', '420887466.0', '2.9446263313293457'], ['600016', '2010-01-05', '4.7106499671936035', '4.513889789581299', '4.623839855194092', '4.670139789581299', '397762846.0', '2.996613025665283'], ['600016', '2010-01-06', '4.675930023193359', '4.571760177612305', '4.646989822387695', '4.577549934387207', '279384090.0', '2.937202215194702'], ['600016', '2010-01-07', '4.583330154418945', '4.427080154418945', '4.571760177612305', '4.456019878387451', '287722658.0', '2.859222173690796'], ['600016', '2010-01-08', '4.519680023193359', '4.421299934387207', '4.450230121612549', '4.502309799194336', '203065401.0', '2.8889243602752686'], ['600016', '2010-01-11', '4.751160144805908', '4.513889789581299', '4.716430187225342', '4.5543999671936035', '446305394.0', '2.9223475456237793'], ['600016', '2010-01-12', '4.606480121612549', '4.3981499671936035', '4.5254597663879395', '4.577549934387207', '316389327.0', '2.937202215194702'], ['600016', '2010-01-13', '4.473380088806152', '4.340280055999756', '4.427080154418945', '4.375', '500350462.0', '2.8072350025177'], ['600016', '2010-01-14', '4.403940200805664', '4.311339855194092', '4.3981499671936035', '4.3807902336120605', '250090571.0', '2.810950517654419'], ['600016', '2010-01-15', '4.421299934387207', '4.317130088806152', '4.386569976806641', '4.3807902336120605', '200494565.0', '2.810950517654419'], ['600016', '2010-01-18', '4.403940200805664', '4.340280055999756', '4.346059799194336', '4.392360210418701', '195516441.0', '2.8183746337890625'], ['600016', '2010-01-19', '4.484950065612793', '4.403940200805664', '4.403940200805664', '4.461810111999512', '266631853.0', '2.8629374504089355'], ['600016', '2010-01-20', '4.479169845581055', '4.317130088806152', '4.473380088806152', '4.340280055999756', '217100028.0', '2.78495717048645'], ['600016', '2010-01-21', '4.456019878387451', '4.334489822387695', '4.346059799194336', '4.415510177612305', '206920647.0', '2.833228826522827'], ['600016', '2010-01-22', '4.583330154418945', '4.328700065612793', '4.3518500328063965', '4.502309799194336', '478445910.0', '2.8889243602752686'], ['600016', '2010-01-25', '4.542819976806641', '4.3981499671936035', '4.427080154418945', '4.415510177612305', '210411535.0', '2.833228826522827'], ['600016', '2010-01-26', '4.479169845581055', '4.340280055999756', '4.409719944000244', '4.3692097663879395', '195809873.0', '2.8035202026367188'], ['600016', '2010-01-27', '4.415510177612305', '4.2129597663879395', '4.3807902336120605', '4.236110210418701', '206082627.0', '2.71811580657959'], ['600016', '2010-01-28', '4.259260177612305', '4.166669845581055', '4.253469944000244', '4.1956000328063965', '176181287.0', '2.6921229362487793']]

5、多文件中数据合并到一个文件

import os


def get_list(pathname):
    """接收路径名为参数,返回路径下的文件名列表"""
    return os.listdir(pathname)[:-1]  # [:-1]返回去除最后一个文件的列表,去掉 '沪市股票top300.csv'


def merge_data(name_ls):
    """接收文件名为列表,返回二维列表"""
    stock_data = []
    for filename in name_ls:
        with open(path + filename) as file_obj:
            title = file_obj.readline()  # 读取第一行,标题行,返回字符串
            title = ['stock_code'] + title.strip().split(',')  # 为标题行增加股票代码

            for line in file_obj:  # 遍历文件剩余行
                data = line.strip().split(',')  # 当前行数据切分为列表
                data_with_code = [filename[:-4]] + data  # 股票代码增加到数据中./sample/600000.csv,切取代码如“600000”
                stock_data.append(data_with_code)  # 每行列表,增加到二维列表中
    return [title] + stock_data    # 标题行做为二维列表中的第一个元素


def merge_file(stock_all, filename):
    """接收二维列表,写入到文件中,无返回值"""
    with open(filename, 'w') as fw:  # 以写模式创建文件对象
        for stock in stock_all:  # 遍历二维列表
            line = ','.join(stock) + '\n'  # 每个子列表连接为一个字符串,在末尾拼接上换行符
            fw.write(line)  # 字符串写入文件
    print('写入文件成功!')


def check_file(filename):
    """读取写入的文件,查看数据是否正确"""
    print('写入的文件中的数据如下:')
    with open(filename) as fr:
        return fr.read()


if __name__ == '__main__':
    path = '.\sample\'  # 源文件路径
    new_file = '合并的股票数据.csv'
    name_list = get_list(path)
    stock_info = merge_data(name_list)
    merge_file(stock_info, new_file)
    print(check_file(new_file))

运行的结果是:

写入文件成功!
写入的文件中的数据如下:
stock_code,Date,High,Low,Open,Close,Volume,Adj Close
600000,2010-01-04,9.049530029296875,8.75574016571045,9.032979965209961,8.768150329589844,159964607.0,5.441317081451416
600000,2010-01-05,8.929530143737793,8.602640151977539,8.859189987182617,8.834360122680664,278278034.0,5.4824042320251465
600000,2010-01-06,8.81367015838623,8.639880180358887,8.809530258178711,8.66057014465332,233894449.0,5.3745551109313965
600000,2010-01-07,8.706089973449707,8.399880409240723,8.639880180358887,8.466090202331543,205990015.0,5.253864765167236
600000,2010-01-08,8.606780052185059,8.399880409240723,8.4164400100708,8.561260223388672,158795668.0,5.312924861907959
600000,2010-01-11,9.020569801330566,8.51161003112793,8.937809944152832,8.561260223388672,281073839.0,5.312924861907959
600000,2010-01-12,8.677120208740234,8.383330345153809,8.536430358886719,8.606780052185059,199017998.0,5.34117317199707
600000,2010-01-13,8.420570373535156,8.19299030303955,8.379190444946289,8.205400466918945,353804116.0,5.092085838317871
600000,2010-01-14,8.28402042388916,8.126779556274414,8.221960067749023,8.263330459594727,186909441.0,5.1280364990234375
600000,2010-01-15,8.379190444946289,8.159890174865723,8.28402042388916,8.2923002243042,167196170.0,5.146015167236328
600000,2010-01-18,8.395750045776367,8.221960067749023,8.238510131835938,8.375060081481934,169024525.0,5.197373867034912
600000,2010-01-19,8.519880294799805,8.362640380859375,8.379190444946289,8.420570373535156,169087168.0,5.225615978240967
600000,2010-01-20,8.495059967041016,8.110230445861816,8.449540138244629,8.188850402832031,195212592.0,5.081815719604492
600000,2010-01-21,8.51161003112793,8.176440238952637,8.226090431213379,8.470230102539062,225763730.0,5.256433963775635
600000,2010-01-22,8.730910301208496,8.279890060424805,8.35851001739502,8.648159980773926,373249590.0,5.3668532371521
600000,2010-01-25,8.681260108947754,8.449540138244629,8.50747013092041,8.466090202331543,193898427.0,5.253864765167236
600000,2010-01-26,8.648159980773926,8.346090316772461,8.478500366210938,8.561260223388672,222183082.0,5.312924861907959
600000,2010-01-27,8.606780052185059,8.184709548950195,8.552989959716797,8.217820167541504,227808686.0,5.099793910980225
600000,2010-01-28,8.213680267333984,8.019200325012207,8.184709548950195,8.151610374450684,141840241.0,5.058705806732178
600004,2010-01-04,7.089660167694092,6.993100166320801,7.0,7.0,22444338.0,4.525339603424072
600004,2010-01-05,7.062069892883301,6.993100166320801,7.0,7.027589797973633,16052837.0,4.543176174163818
600004,2010-01-06,7.027589797973633,6.910339832305908,7.013790130615234,6.924139976501465,13645464.0,4.476297378540039
600004,2010-01-07,6.931029796600342,6.696549892425537,6.896550178527832,6.744830131530762,12994629.0,4.360378742218018
600004,2010-01-08,7.068970203399658,6.7103400230407715,6.7103400230407715,7.020689964294434,21639527.0,4.538715362548828
600004,2010-01-11,7.213789939880371,7.020689964294434,7.075860023498535,7.165520191192627,31004200.0,4.6323442459106445
600004,2010-01-12,7.22068977355957,7.068970203399658,7.124139785766602,7.213789939880371,18696800.0,4.663549423217773
600004,2010-01-13,7.241380214691162,7.041379928588867,7.075860023498535,7.110340118408203,20884404.0,4.5966715812683105
600004,2010-01-14,7.400000095367432,7.089660167694092,7.103449821472168,7.365520000457764,26863236.0,4.761639595031738
600004,2010-01-15,7.400000095367432,7.262070178985596,7.3586201667785645,7.31033992767334,14603810.0,4.7259674072265625
600004,2010-01-18,7.6413798332214355,7.241380214691162,7.31033992767334,7.558619976043701,27816184.0,4.886474609375
600004,2010-01-19,7.724140167236328,7.482759952545166,7.517240047454834,7.65516996383667,29316690.0,4.948891639709473
600004,2010-01-20,7.696549892425537,7.510340213775635,7.668970108032227,7.579309940338135,28765702.0,4.899850368499756
600004,2010-01-21,7.827589988708496,7.448279857635498,7.758619785308838,7.475860118865967,28196748.0,4.832971572875977
600004,2010-01-22,7.986209869384766,7.455170154571533,7.517240047454834,7.6413798332214355,58896409.0,4.939977169036865
600004,2010-01-25,7.77931022644043,7.303450107574463,7.662069797515869,7.317240238189697,29152040.0,4.730428218841553
600004,2010-01-26,7.400000095367432,7.034480094909668,7.317240238189697,7.165520191192627,21009601.0,4.6323442459106445
600004,2010-01-27,7.234479904174805,7.041379928588867,7.172410011291504,7.089660167694092,11260503.0,4.583302021026611
600004,2010-01-28,7.400000095367432,7.034480094909668,7.089660167694092,7.386209964752197,22893367.0,4.775014877319336
600006,2010-01-04,7.070000171661377,6.900000095367432,6.929999828338623,6.909999847412109,23281430.0,6.176186561584473
600006,2010-01-05,6.940000057220459,6.75,6.909999847412109,6.869999885559082,16569457.0,6.140435695648193
600006,2010-01-06,7.03000020980835,6.809999942779541,6.869999885559082,6.889999866485596,21867767.0,6.158311367034912
600006,2010-01-07,6.880000114440918,6.539999961853027,6.849999904632568,6.559999942779541,27696059.0,5.86335563659668
600006,2010-01-08,6.630000114440918,6.480000019073486,6.559999942779541,6.619999885559082,12747269.0,5.916983127593994
600006,2010-01-11,6.739999771118164,6.5,6.659999847412109,6.519999980926514,13057756.0,5.827603340148926
600006,2010-01-12,6.679999828338623,6.5,6.570000171661377,6.679999828338623,15268352.0,5.970611095428467
600006,2010-01-13,6.610000133514404,6.489999771118164,6.590000152587891,6.519999980926514,14191042.0,5.827603340148926
600006,2010-01-14,6.639999866485596,6.519999980926514,6.519999980926514,6.619999885559082,13557759.0,5.916983127593994
600006,2010-01-15,6.789999961853027,6.599999904632568,6.619999885559082,6.739999771118164,18139223.0,6.024240016937256
600006,2010-01-18,6.820000171661377,6.659999847412109,6.789999961853027,6.760000228881836,14608947.0,6.042116641998291
600006,2010-01-19,6.820000171661377,6.639999866485596,6.820000171661377,6.679999828338623,17516772.0,5.970611095428467
600006,2010-01-20,6.800000190734863,6.550000190734863,6.679999828338623,6.579999923706055,25474831.0,5.881231307983398
600006,2010-01-21,6.900000095367432,6.690000057220459,6.760000228881836,6.760000228881836,36100876.0,6.042116641998291
600006,2010-01-22,6.650000095367432,6.320000171661377,6.650000095367432,6.400000095367432,28445190.0,5.720346927642822
600006,2010-01-25,6.389999866485596,6.190000057220459,6.340000152587891,6.199999809265137,12549070.0,5.541585445404053
600006,2010-01-26,6.28000020980835,5.880000114440918,6.210000038146973,5.900000095367432,12855146.0,5.273444175720215
600006,2010-01-27,5.980000019073486,5.699999809265137,5.900000095367432,5.710000038146973,17086828.0,5.103621482849121
600006,2010-01-28,5.800000190734863,5.619999885559082,5.690000057220459,5.769999980926514,9583801.0,5.157249450683594
600007,2010-01-04,12.399999618530273,11.829999923706055,12.399999618530273,11.859999656677246,5257993.0,9.957270622253418
600007,2010-01-05,11.930000305175781,11.380000114440918,11.859999656677246,11.479999542236328,6131146.0,9.63823413848877
600007,2010-01-06,11.670000076293945,11.479999542236328,11.489999771118164,11.59000015258789,3659270.0,9.73058795928955
600007,2010-01-07,11.819999694824219,11.550000190734863,11.600000381469727,11.739999771118164,4344484.0,9.856523513793945
600007,2010-01-08,11.739999771118164,11.430000305175781,11.649999618530273,11.630000114440918,4826947.0,9.764169692993164
600007,2010-01-11,11.779999732971191,11.050000190734863,11.710000038146973,11.3100004196167,7622395.0,9.49551010131836
600007,2010-01-12,11.350000381469727,10.90999984741211,11.289999961853027,11.329999923706055,5886011.0,9.512300491333008
600007,2010-01-13,11.109999656677246,10.90999984741211,11.109999656677246,10.949999809265137,4733046.0,9.19326400756836
600007,2010-01-14,11.130000114440918,10.930000305175781,11.0,11.109999656677246,3725035.0,9.327594757080078
600007,2010-01-15,11.34000015258789,11.09000015258789,11.119999885559082,11.199999809265137,5977276.0,9.403157234191895
600007,2010-01-18,11.289999961853027,11.130000114440918,11.180000305175781,11.279999732971191,6654531.0,9.470320701599121
600007,2010-01-19,11.380000114440918,11.25,11.279999732971191,11.300000190734863,4918996.0,9.487113952636719
600007,2010-01-20,11.350000381469727,10.8100004196167,11.34000015258789,10.819999694824219,4827128.0,9.084121704101562
600007,2010-01-21,10.899999618530273,10.710000038146973,10.829999923706055,10.850000381469727,2787098.0,9.109307289123535
600007,2010-01-22,10.760000228881836,10.359999656677246,10.760000228881836,10.5,3665314.0,8.815459251403809
600007,2010-01-25,10.800000190734863,10.359999656677246,10.460000038146973,10.699999809265137,2584601.0,8.983370780944824
600007,2010-01-26,10.699999809265137,10.449999809265137,10.649999618530273,10.65999984741211,2482257.0,8.949789047241211
600007,2010-01-27,10.869999885559082,10.449999809265137,10.600000381469727,10.850000381469727,4022402.0,9.109307289123535
600007,2010-01-28,11.0,10.600000381469727,10.800000190734863,11.0,6071121.0,9.23524284362793
600008,2010-01-04,3.6500000953674316,3.565000057220459,3.634999990463257,3.575000047683716,28141264.0,2.5811192989349365
600008,2010-01-05,3.5899999141693115,3.515000104904175,3.5799999237060547,3.565000057220459,37961332.0,2.573899269104004
600008,2010-01-06,3.6649999618530273,3.5950000286102295,3.5950000286102295,3.5999999046325684,48343282.0,2.5991690158843994
600008,2010-01-07,3.609999895095825,3.515000104904175,3.609999895095825,3.5250000953674316,30403996.0,2.5450193881988525
600008,2010-01-08,3.555000066757202,3.494999885559082,3.5,3.549999952316284,24959566.0,2.5630693435668945
600008,2010-01-11,3.5999999046325684,3.4700000286102295,3.569999933242798,3.5250000953674316,38739902.0,2.5450193881988525
600008,2010-01-12,3.5999999046325684,3.494999885559082,3.5350000858306885,3.5999999046325684,41444678.0,2.5991690158843994
600008,2010-01-13,3.619999885559082,3.5250000953674316,3.5299999713897705,3.5299999713897705,34469714.0,2.5486292839050293
600008,2010-01-14,3.619999885559082,3.5299999713897705,3.5450000762939453,3.609999895095825,40375736.0,2.606388807296753
600008,2010-01-15,3.6700000762939453,3.5950000286102295,3.634999990463257,3.6500000953674316,61858412.0,2.635268449783325
600008,2010-01-18,3.740000009536743,3.619999885559082,3.6649999618530273,3.7300000190734863,59658852.0,2.6930277347564697
600008,2010-01-19,3.765000104904175,3.674999952316284,3.75,3.694999933242798,43811408.0,2.6677582263946533
600008,2010-01-20,3.759999990463257,3.630000114440918,3.7049999237060547,3.6600000858306885,63839868.0,2.6424882411956787
600008,2010-01-21,3.7300000190734863,3.615000009536743,3.6649999618530273,3.694999933242798,47452994.0,2.6677582263946533
600008,2010-01-22,3.694999933242798,3.509999990463257,3.625,3.549999952316284,47527890.0,2.5630693435668945
600008,2010-01-25,3.575000047683716,3.5,3.505000114440918,3.505000114440918,21810998.0,2.5305800437927246
600008,2010-01-26,3.5299999713897705,3.299999952316284,3.5299999713897705,3.3350000381469727,39234732.0,2.407841205596924
600008,2010-01-27,3.365000009536743,3.25,3.3399999141693115,3.2699999809265137,28790360.0,2.3609116077423096
600008,2010-01-28,3.3299999237060547,3.2799999713897705,3.2799999713897705,3.319999933242798,17576242.0,2.3970110416412354
600009,2010-01-04,18.25,17.450000762939453,17.450000762939453,17.899999618530273,47821206.0,15.014424324035645
600009,2010-01-05,18.280000686645508,17.809999465942383,17.899999618530273,18.020000457763672,25767982.0,15.115082740783691
600009,2010-01-06,18.049999237060547,17.600000381469727,18.0,17.700000762939453,19371487.0,14.846667289733887
600009,2010-01-07,17.959999084472656,17.459999084472656,17.600000381469727,17.520000457763672,22599261.0,14.695682525634766
600009,2010-01-08,18.299999237060547,17.350000381469727,17.40999984741211,17.940000534057617,28840870.0,15.047977447509766
600009,2010-01-11,18.68000030517578,17.889999389648438,18.299999237060547,18.190000534057617,35598501.0,15.257675170898438
600009,2010-01-12,18.309999465942383,17.8799991607666,18.190000534057617,18.059999465942383,32283334.0,15.148630142211914
600009,2010-01-13,18.790000915527344,17.579999923706055,17.6299991607666,18.40999984741211,44525929.0,15.442209243774414
600009,2010-01-14,19.469999313354492,18.280000686645508,18.450000762939453,19.290000915527344,37892359.0,16.180349349975586
600009,2010-01-15,19.40999984741211,19.0,19.260000228881836,19.1200008392334,17932939.0,16.037755966186523
600009,2010-01-18,21.0,19.170000076293945,19.18000030517578,20.510000228881836,52589069.0,17.20368003845215
600009,2010-01-19,20.729999542236328,20.209999084472656,20.56999969482422,20.56999969482422,31242861.0,17.254011154174805
600009,2010-01-20,20.540000915527344,19.530000686645508,20.540000915527344,19.68000030517578,34882325.0,16.507478713989258
600009,2010-01-21,20.450000762939453,19.299999237060547,19.690000534057617,19.719999313354492,33745950.0,16.541030883789062
600009,2010-01-22,20.1200008392334,19.0,19.59000015258789,19.31999969482422,38415756.0,16.20551109313965
600009,2010-01-25,19.280000686645508,18.399999618530273,19.280000686645508,18.479999542236328,26530113.0,15.500926971435547
600009,2010-01-26,18.700000762939453,17.860000610351562,18.40999984741211,18.559999465942383,31250551.0,15.568026542663574
600009,2010-01-27,18.649999618530273,18.040000915527344,18.399999618530273,18.18000030517578,18448373.0,15.249288558959961
600009,2010-01-28,18.549999237060547,18.100000381469727,18.149999618530273,18.549999237060547,17711697.0,15.559640884399414
600010,2010-01-04,1.664289951324463,1.6357100009918213,1.6607099771499634,1.6357100009918213,87618140.0,1.5676798820495605
600010,2010-01-05,1.6428600549697876,1.600000023841858,1.6357100009918213,1.6285699605941772,96975623.0,1.560836672782898
600010,2010-01-06,1.6571400165557861,1.6071399450302124,1.625,1.632140040397644,101696090.0,1.5642582178115845
600010,2010-01-07,1.632140040397644,1.5892900228500366,1.632140040397644,1.5928599834442139,88698358.0,1.5266119241714478
600010,2010-01-08,1.6071399450302124,1.571429967880249,1.5928599834442139,1.600000023841858,83714400.0,1.5334550142288208
600010,2010-01-11,1.6392899751663208,1.5892900228500366,1.632140040397644,1.5928599834442139,62564902.0,1.5266119241714478
600010,2010-01-12,1.617859959602356,1.5750000476837158,1.5750000476837158,1.6142899990081787,69193312.0,1.5471504926681519
600010,2010-01-13,1.600000023841858,1.5750000476837158,1.5928599834442139,1.578570008277893,91232425.0,1.5129163265228271
600010,2010-01-14,1.5964299440383911,1.5750000476837158,1.578570008277893,1.5928599834442139,63042263.0,1.5266119241714478
600010,2010-01-15,1.5964299440383911,1.571429967880249,1.5928599834442139,1.5928599834442139,70785467.0,1.5266119241714478
600010,2010-01-18,1.5964299440383911,1.571429967880249,1.585710048675537,1.5928599834442139,72970103.0,1.5266119241714478
600010,2010-01-19,1.6285699605941772,1.585710048675537,1.5928599834442139,1.6214300394058228,136309846.0,1.553993582725525
600010,2010-01-20,1.6357100009918213,1.5607099533081055,1.6214300394058228,1.571429967880249,106613500.0,1.506073236465454
600010,2010-01-21,1.5821399688720703,1.553570032119751,1.571429967880249,1.5642900466918945,66865142.0,1.499230146408081
600010,2010-01-22,1.5607099533081055,1.5035699605941772,1.5571399927139282,1.5321400165557861,91190607.0,1.4684172868728638
600010,2010-01-25,1.524999976158142,1.4964300394058228,1.5214300155639648,1.5,58433757.0,1.4376139640808105
600010,2010-01-26,1.507140040397644,1.428570032119751,1.5,1.4571399688720703,74686721.0,1.3965364694595337
600010,2010-01-27,1.4642900228500366,1.428570032119751,1.4571399688720703,1.4500000476837158,49209558.0,1.3896936178207397
600010,2010-01-28,1.4678599834442139,1.4392900466918945,1.4500000476837158,1.4571399688720703,36010957.0,1.3965364694595337
600011,2010-01-04,8.130000114440918,7.989999771118164,8.109999656677246,8.010000228881836,13471969.0,5.488150119781494
600011,2010-01-05,8.09000015258789,7.900000095367432,8.029999732971191,8.09000015258789,12001396.0,5.54296350479126
600011,2010-01-06,8.140000343322754,8.039999961853027,8.100000381469727,8.039999961853027,13496984.0,5.508705139160156
600011,2010-01-07,8.020000457763672,7.849999904632568,8.020000457763672,7.860000133514404,10262641.0,5.3853759765625
600011,2010-01-08,7.860000133514404,7.860000133514404,7.860000133514404,7.860000133514404,0.0,5.3853759765625
600011,2010-01-11,7.860000133514404,7.860000133514404,7.860000133514404,7.860000133514404,0.0,5.3853759765625
600011,2010-01-12,7.860000133514404,7.860000133514404,7.860000133514404,7.860000133514404,0.0,5.3853759765625
600011,2010-01-13,7.860000133514404,7.860000133514404,7.860000133514404,7.860000133514404,0.0,5.3853759765625
600011,2010-01-14,7.860000133514404,7.860000133514404,7.860000133514404,7.860000133514404,0.0,5.3853759765625
600011,2010-01-15,7.860000133514404,7.860000133514404,7.860000133514404,7.860000133514404,0.0,5.3853759765625
600011,2010-01-18,8.34000015258789,7.800000190734863,7.829999923706055,8.020000457763672,20917280.0,5.495001792907715
600011,2010-01-19,8.109999656677246,7.989999771118164,8.039999961853027,8.020000457763672,14115371.0,5.495001792907715
600011,2010-01-20,8.050000190734863,7.78000020980835,8.020000457763672,7.800000190734863,13483884.0,5.344265937805176
600011,2010-01-21,7.860000133514404,7.71999979019165,7.800000190734863,7.78000020980835,8300195.0,5.330562114715576
600011,2010-01-22,7.809999942779541,7.630000114440918,7.75,7.710000038146973,7681392.0,5.282601833343506
600011,2010-01-25,7.800000190734863,7.639999866485596,7.679999828338623,7.71999979019165,5071674.0,5.289453506469727
600011,2010-01-26,7.739999771118164,7.389999866485596,7.71999979019165,7.409999847412109,6956304.0,5.077053546905518
600011,2010-01-27,7.489999771118164,7.360000133514404,7.409999847412109,7.369999885559082,4690595.0,5.049646854400635
600011,2010-01-28,7.429999828338623,7.25,7.400000095367432,7.289999961853027,7924234.0,4.994833469390869
600012,2010-01-04,5.96999979019165,5.860000133514404,5.96999979019165,5.869999885559082,4457081.0,3.938664197921753
600012,2010-01-05,5.909999847412109,5.809999942779541,5.880000114440918,5.900000095367432,4036819.0,3.958794355392456
600012,2010-01-06,5.960000038146973,5.860000133514404,5.900000095367432,5.880000114440918,4436603.0,3.9453744888305664
600012,2010-01-07,5.889999866485596,5.730000019073486,5.860000133514404,5.760000228881836,4516599.0,3.864856719970703
600012,2010-01-08,5.829999923706055,5.730000019073486,5.739999771118164,5.809999942779541,3889700.0,3.898404836654663
600012,2010-01-11,6.039999961853027,5.800000190734863,5.849999904632568,6.03000020980835,15850923.0,4.046021938323975
600012,2010-01-12,6.369999885559082,5.989999771118164,6.019999980926514,6.309999942779541,25963574.0,4.233896255493164
600012,2010-01-13,6.53000020980835,6.239999771118164,6.239999771118164,6.28000020980835,25576301.0,4.2137675285339355
600012,2010-01-14,6.420000076293945,6.21999979019165,6.360000133514404,6.329999923706055,11431174.0,4.247316360473633
600012,2010-01-15,6.349999904632568,6.239999771118164,6.300000190734863,6.309999942779541,7707084.0,4.233896255493164
600012,2010-01-18,6.550000190734863,6.230000019073486,6.300000190734863,6.510000228881836,16247472.0,4.368093013763428
600012,2010-01-19,7.159999847412109,6.449999809265137,6.510000228881836,7.159999847412109,39701483.0,4.804232120513916
600012,2010-01-20,7.880000114440918,7.349999904632568,7.349999904632568,7.880000114440918,127174906.0,5.2873382568359375
600012,2010-01-21,7.75,7.199999809265137,7.699999809265137,7.519999980926514,69143612.0,5.045784950256348
600012,2010-01-22,8.15999984741211,7.53000020980835,7.579999923706055,7.619999885559082,81485220.0,5.1128830909729
600012,2010-01-25,7.449999809265137,7.099999904632568,7.300000190734863,7.159999847412109,32671736.0,4.804232120513916
600012,2010-01-26,7.289999961853027,6.5,7.159999847412109,6.760000228881836,31443993.0,4.535838603973389
600012,2010-01-27,7.059999942779541,6.519999980926514,6.659999847412109,6.820000171661377,34603457.0,4.57609748840332
600012,2010-01-28,7.349999904632568,6.659999847412109,6.679999828338623,7.320000171661377,37295526.0,4.911588668823242
600015,2010-01-04,6.714739799499512,6.543799877166748,6.629270076751709,6.559830188751221,84191152.0,4.2687907218933105
600015,2010-01-05,6.752140045166016,6.463679790496826,6.60791015625,6.725430011749268,110703114.0,4.376554489135742
600015,2010-01-06,6.704060077667236,6.469019889831543,6.693379878997803,6.479700088500977,101824254.0,4.216646194458008
600015,2010-01-07,6.543799877166748,6.3140997886657715,6.479700088500977,6.346149921417236,95875566.0,4.129738807678223
600015,2010-01-08,6.431620121002197,6.25,6.303420066833496,6.388889789581299,53191613.0,4.1575517654418945
600015,2010-01-11,6.677350044250488,6.415599822998047,6.613249778747559,6.442309856414795,97118276.0,4.192315101623535
600015,2010-01-12,6.661320209503174,6.2927398681640625,6.410260200500488,6.629270076751709,91346009.0,4.313979148864746
600015,2010-01-13,6.47435998916626,6.143159866333008,6.410260200500488,6.191239833831787,136231818.0,4.0289306640625
600015,2010-01-14,6.244659900665283,6.079060077667236,6.2072601318359375,6.196579933166504,65020622.0,4.032406806945801
600015,2010-01-15,6.282050132751465,6.137819766998291,6.1859002113342285,6.191239833831787,53218633.0,4.0289306640625
600015,2010-01-18,6.180560111999512,6.079060077667236,6.1591901779174805,6.148499965667725,55010030.0,4.0011186599731445
600015,2010-01-19,6.255340099334717,6.137819766998291,6.175209999084473,6.169869899749756,50164823.0,4.0150251388549805
600015,2010-01-20,6.212609767913818,5.876070022583008,6.1859002113342285,5.908120155334473,68328187.0,3.8446922302246094
600015,2010-01-21,6.143159866333008,5.886750221252441,5.886750221252441,6.079060077667236,67374888.0,3.9559309482574463
600015,2010-01-22,6.3408098220825195,5.945509910583496,5.98291015625,6.2660298347473145,111889562.0,4.077601432800293
600015,2010-01-25,6.287390232086182,6.127140045166016,6.148499965667725,6.143159866333008,46498007.0,3.9976444244384766
600016,2010-01-04,4.716430187225342,4.583330154418945,4.646989822387695,4.589119911193848,420887466.0,2.9446263313293457
600016,2010-01-05,4.7106499671936035,4.513889789581299,4.623839855194092,4.670139789581299,397762846.0,2.996613025665283
600016,2010-01-06,4.675930023193359,4.571760177612305,4.646989822387695,4.577549934387207,279384090.0,2.937202215194702
600016,2010-01-07,4.583330154418945,4.427080154418945,4.571760177612305,4.456019878387451,287722658.0,2.859222173690796
600016,2010-01-08,4.519680023193359,4.421299934387207,4.450230121612549,4.502309799194336,203065401.0,2.8889243602752686
600016,2010-01-11,4.751160144805908,4.513889789581299,4.716430187225342,4.5543999671936035,446305394.0,2.9223475456237793
600016,2010-01-12,4.606480121612549,4.3981499671936035,4.5254597663879395,4.577549934387207,316389327.0,2.937202215194702
600016,2010-01-13,4.473380088806152,4.340280055999756,4.427080154418945,4.375,500350462.0,2.8072350025177
600016,2010-01-14,4.403940200805664,4.311339855194092,4.3981499671936035,4.3807902336120605,250090571.0,2.810950517654419
600016,2010-01-15,4.421299934387207,4.317130088806152,4.386569976806641,4.3807902336120605,200494565.0,2.810950517654419
600016,2010-01-18,4.403940200805664,4.340280055999756,4.346059799194336,4.392360210418701,195516441.0,2.8183746337890625
600016,2010-01-19,4.484950065612793,4.403940200805664,4.403940200805664,4.461810111999512,266631853.0,2.8629374504089355
600016,2010-01-20,4.479169845581055,4.317130088806152,4.473380088806152,4.340280055999756,217100028.0,2.78495717048645
600016,2010-01-21,4.456019878387451,4.334489822387695,4.346059799194336,4.415510177612305,206920647.0,2.833228826522827
600016,2010-01-22,4.583330154418945,4.328700065612793,4.3518500328063965,4.502309799194336,478445910.0,2.8889243602752686
600016,2010-01-25,4.542819976806641,4.3981499671936035,4.427080154418945,4.415510177612305,210411535.0,2.833228826522827
600016,2010-01-26,4.479169845581055,4.340280055999756,4.409719944000244,4.3692097663879395,195809873.0,2.8035202026367188
600016,2010-01-27,4.415510177612305,4.2129597663879395,4.3807902336120605,4.236110210418701,206082627.0,2.71811580657959
600016,2010-01-28,4.259260177612305,4.166669845581055,4.253469944000244,4.1956000328063965,176181287.0,2.6921229362487793

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/83822.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

数字图像处理(入门篇)九 图像数据预处理之滤波

目录 1 模板运算 (1)模板卷积 (2)模板排序 2 均值滤波 (1)代码 (2)结果图 3 高斯滤波 (1)代码 (2)结果图 4 中值滤波 &#…

IB数学HL/SL考试大纲简单介绍

IB数学难度怎么样?IB数学内部评估和外部评估是怎么评分的,IB数学HL和SL的考试大纲? 下面介绍IB数学框架体系IB数学SL考试大纲 SL数学为必修课 考试内容相对比较基础 代数(Algebra):涉及数列问题&#xff…

CentOS虚拟机搭建Hive环境

注&#xff1a;本文是对 https://www.bilibili.com/video/BV1CU4y1N7Sh 的实践。 关于如何搭建Hadoop集群&#xff0c;请参考我另一篇文档。 环境 CentOS 7.7JDK 8Hadoop 3.3.0Hive 3.1.2 准备 确认Hadoop的 etc/hadoop/core-site.xml 文件包含如下配置&#xff1a; <…

3D建模师做多了女人会不会找不到老婆?次世代美少女战士建模流程讲解

什么是次世代&#xff1f; 次世代是个舶来语&#xff0c;“次世代游戏”指代和同类游戏相比下更加先进的游戏&#xff0c;即“下一代游戏”。 次世代是利用高模烘焙的法线贴图回帖到低模上&#xff0c;让低模在游戏引擎里可以及时显示高模的视觉效果。模型面数比较高&#xf…

Python实现PSO粒子群优化卷积神经网络CNN回归模型项目实战

说明&#xff1a;这是一个机器学习实战项目&#xff08;附带数据代码文档视频讲解&#xff09;&#xff0c;如需数据代码文档视频讲解可以直接到文章最后获取。 1.项目背景 PSO是粒子群优化算法&#xff08;Particle Swarm Optimization&#xff09;的英文缩写&#xff0c;是一…

学完这篇,再不怕防火墙NAT策略问题

Q&A 1、配置了nat server后Tracert防火墙上的global地址&#xff0c;显示信息是什么? 无论具有Inside地址的设备在防火墙内部有多少跳&#xff0c;Tracert时全部显示nat server的global的地址。如果有3跳&#xff0c;则显示3次global地址。 2、nat server和destination-n…

艾美捷CMRL-1066培养基背景和化学性质分析

艾美捷CMRL-1066培养基背景&#xff1a; CMRL-1066是20世纪60年代后期在康诺医学研究实验室开发的一种化学定义的培养基。CMRL-1066最初设计用于非补充培养物中的小鼠L细胞。虽然CMRL-1066是为无血清培养而开发的&#xff0c;但它可以补充血清并用于支持多种细胞类型的生长。适…

[激光原理与应用-50]:《激光焊接质量实时监测系统研究》-1-绪论 (模式识别)

目录 1.1 问题概述 1.2 激光焊接质量监测在国内外的研究现状 1.2.1 国内外研究概况、水平和发展趋势 1.2.2 信号检测与传感器 1.2.3 信号分析与缺陷诊断 &#xff08;DSP或FPGA&#xff09; 1.3 本课题研究内容及意义 后记&#xff1a; 1.1 问题概述 激光焊接是一种高效…

YOLO v3

参考 YOLO v3 - 云社区 - 腾讯云 摘要 我们对YOLO进行了一些更新&#xff01;我们做了一些小的设计改变使它更好。我们还训练了这个非常棒的新网络。比上次大一点&#xff0c;但更准确。不过还是很快的&#xff0c;别担心。在320 320的情况下&#xff0c;YOLOv3在28.2 mAP下…

跳板攻击中如何追踪定位攻击者主机(上)

前段时间西北工业大学遭受NAS攻击事件中&#xff0c;TAO在针对西北工业大学的网络攻击行动中先后使用了54台跳板机和代理服务器&#xff0c;主要分布在日本、韩国、瑞典、波兰、乌克兰等17个国家&#xff0c;其中70%位于中国周边国家&#xff0c;如日本、韩国等。 同时&#x…

芯片漫游指南(3)-- UVM通信

目录1.TLM通信1.1 概述1.2 基本概念1.3 分类1.4 端口的使用2. 单向通信2.1 概念2.2 方法2.3 示例3.双向通信3.1 概述3.2 分类3.3 transport4. 多向通信4.1 概述4.2 示例5.通信管道5.1 概述5.2 TLM FIFO5.3 Analysis Port5.4 analysis TLM FIFO5.5 request & response通信管…

[附源码]JAVA毕业设计疫情防控期间人员档案追演示录像下(系统+LW)

[附源码]JAVA毕业设计疫情防控期间人员档案追演示录像下&#xff08;系统LW&#xff09; 项目运行 环境项配置&#xff1a; Jdk1.8 Tomcat8.5 Mysql HBuilderX&#xff08;Webstorm也行&#xff09; Eclispe&#xff08;IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持&#x…

Springboot内置的工具类之ObjectUtils

在实际业务开发中&#xff0c;有时候经常需要判断对象是否为空、数组是否为空、两个对象是否相等&#xff0c;数组中是否包含某个元素&#xff0c;往数组中追加元素等这些操作&#xff0c;每次都手写太麻烦&#xff0c;然后很多人的选择是封装成util工具类&#xff0c;实际上类…

Golang protobuf

文章目录protobuf 和 grpc 的区别下载工具 protoc为什么要使用 protocprotoc 基本语法基础用法结构体声明protoc生成结构体服务声明生成服务使用生成的服务端使用生成的客户端protobuf 和 grpc 的区别 grpc 是开源的rpc框架 protobuf是编码协议下载工具 protoc https://githu…

人工神经网络/ANN简介

目录 前言 1.什么是训练集、测试集和验证集&#xff1f; 2.人工神经网络和 生物神经元结构对应的理解 3.什么是梯度下降法&#xff0c;在神经网络上如何用于调节权重&#xff1f; 4.为什么神经网络要进行归一化处理&#xff1f; 5.激活函数的形式&#xff1a; 6.NN分类 …

序列模型(自回归模型,马尔可夫模型,因果关系)

李沐老师《动手学深度学习 PyTorch版》课程&#xff0c;小破站也有视频51 序列模型【动手学深度学习v2】_哔哩哔哩_bilibili 主要参考8.1. 序列模型 — 动手学深度学习 2.0.0 documentation 目录 1.基本原理 1.1自回归模型 1.2马尔可夫模型 1.3因果关系 2.训练 3.预测 4…

CMake中link_directories/target_link_directories的使用

CMake中的link_directories命令用于添加目录使链接器能在其查找库(add directories in which the linker will look for libraries)&#xff0c;其格式如下&#xff1a; link_directories([AFTER|BEFORE] directory1 [directory2 ...]) 添加路径使链接器应在其中搜索库。提供给…

【云计算与大数据技术】数据分片哈希算法、路由算法、复制算法的讲解(图文解释 超详细)

一、大数据的存储问题 随着结构化数据量和非结构化数据量的不断增长&#xff0c;以及分析数据来源的多样化&#xff0c;之前的存储系统设计已经无法满足大数据应用的需求&#xff0c;对于大数据的存储&#xff0c;存在以下几个不容忽视的问题 容量 - “大容量”通常是指可达P…

Python+Qt相片更换背景颜色窗体程序

程序示例精选 PythonQt相片更换背景颜色窗体程序 如需安装运行环境或远程调试&#xff0c;见文章底部微信名片&#xff0c;由专业技术人员远程协助&#xff01; 前言 QTPython是非常经典的窗体编程组合&#xff0c;功能完善&#xff0c;可视化界面美观易维护&#xff0c;这篇博…

fpga实操训练(按键输入)

【 声明&#xff1a;版权所有&#xff0c;欢迎转载&#xff0c;请勿用于商业用途。 联系信箱&#xff1a;feixiaoxing 163.com】 在fpga上面进行按键的输入&#xff0c;要比stm32编写按键输入要容易的多。这里面最主要的工作就是把led输出和按键输入绑定在一起。当然&#xff0…