0

我有一个遵循此布局的 csv 文件:

 Finances and enterprises
 Mortgages

Mortgages constituted
Unidades:Capital loaned (millions euros)

,Total,,RUSTIC,,URBAN,,-Urban. Dwellings,,-Urban. Lots,,-Urban. Others,,RUSTIC,,-Rustic with BANK loans,,-Rustic with SAVINGS BANKS loans,,-Rustic with loans at other institutions,,URBAN,,-Urban with BANK loans,,-Urban with SAVINGS BANKS loans,,-Urban with loans at other institutions,,
,Number,Capital loaned,Number,Capital loaned,Number,Capital loaned,Number,Capitalloaned,Number,Capital loaned,Number,Capital loaned,Number,Capital loaned,Number,Capital loaned,Number,Capital loaned,Number,Capital loaned,Number,Capital loaned,Number,Capital loaned,Number,Capital loaned,Number,Capital loaned,
2003M01,"118040.0","11135.75","3469.0","444.5","114571.0","10691.25","89642.0","7937.54","3496.0","1134.3","21434.0","1619.4","3469.0","444.5","1069.0","131.16","1736.0","222.83","659.0","90.51","114571.0","10691.25","44021.0","4287.19","59793.0","5525.87","10756.0","878.2",
2003M02,"119166.0","12017.24","3495.0","534.55","115671.0","11482.69","88381.0","8223.45","3842.0","1194.4","23449.0","2064.78","3495.0","534.55","1241.0","216.91","1549.0","250.43","703.0","67.22","115671.0","11482.69","44135.0","4664.59","61338.0","5855.24","10203.0","962.87",
2003M03,"116565.0","11535.46","3614.0","543.47","112951.0","10991.99","85577.0","8014.6","4302.0","1220.92","23069.0","1756.41","3614.0","543.47","1089.0","164.15","1730.0","307.68","792.0","71.64","112951.0","10991.99","42590.0","4488.27","60875.0","5661.76","9494.0","841.95",

我想使用以“,Total,,RUSTIC,,URBAN”开头的行作为标题将其与熊猫一起导入。问题是以下行还包含有意义的标题。

我想我应该使用组,但我不知道如何使用read_csv().

这是我现在正在做的事情:

output = pandas.read_csv(csv,header=7, sep=',', skip_footer=11, 
                          skiprows=[0,1,2,3,4,5,6], parse_dates=True,
                          index_col=0)

我最终在 output.index.values 中得到了“借出的资本”。不好……</p>

- - - 编辑 - - - -

我的数据提供者更改了 csv 的布局。我仍然遇到同样的错误,但我认为使用 csv 更容易理解我的问题。这是 csv :

2013-06-11 16:19:37,587 - 监控 - 调试 - csv:财务和企业抵押

Mortgages constituted
Unidades:Capital loaned (millions euros)


,Total,RUSTIC,URBAN,-Urban. Dwellings,-Urban. Lots,-Urban. Others,RUSTIC,-Rustic with BANK loans,-Rustic with SAVINGS BANKS loans,-Rustic with loans at other institutions,URBAN,-Urban with BANK loans,-Urban with SAVINGS BANKS loans,-Urban with loans at other institutions,
Number,"","","","","","","","","","","","","","",
       2003M01,"118040.0","3469.0","114571.0","89642.0","3496.0","21434.0","3469.0","1069.0","1736.0","659.0","114571.0","44021.0","59793.0","10756.0",
  2003M02,"119166.0","3495.0","115671.0","88381.0","3842.0","23449.0","3495.0","1241.0","1549.0","703.0","115671.0","44135.0","61338.0","10203.0",
   2003M03,"116565.0","3614.0","112951.0","85577.0","4302.0","23069.0","3614.0","1089.0","1730.0","792.0","112951.0","42590.0","60875.0","9494.0",
   2003M04,"104744.0","3270.0","101474.0","77475.0","3553.0","20438.0","3270.0","1139.0","1569.0","565.0","101474.0","38678.0","53773.0","9024.0",
   2003M05,"116615.0","3605.0","113010.0","86628.0","3652.0","22729.0","3605.0","1116.0","1780.0","708.0","113010.0","43054.0","60303.0","9662.0",
   2003M06,"113086.0","3508.0","109578.0","82968.0","3460.0","23145.0","3508.0","1015.0","1682.0","807.0","109578.0","40334.0","58508.0","10733.0",
   2003M07,"113881.0","3391.0","110490.0","83387.0","3341.0","23753.0","3391.0","1026.0","1702.0","655.0","110490.0","41852.0","59155.0","9477.0",
   2003M08,"92580.0","2647.0","89933.0","67572.0","3167.0","19187.0","2647.0","781.0","1318.0","542.0","89933.0","33688.0","48022.0","8220.0",
   2003M09,"118209.0","3523.0","114686.0","86018.0","3287.0","25377.0","3523.0","1020.0","1887.0","610.0","114686.0","44948.0","59949.0","9791.0",
   2003M10,"129177.0","3824.0","125353.0","90806.0","3341.0","31204.0","3824.0","1193.0","1854.0","779.0","125353.0","49996.0","64493.0","10867.0",
   2003M11,"110775.0","3652.0","107123.0","78483.0","2567.0","26071.0","3652.0","1359.0","1595.0","694.0","107123.0","43818.0","53111.0","10196.0",
   2003M12,"104404.0","3079.0","101325.0","72502.0","3448.0","25374.0","3079.0","1121.0","1386.0","568.0","101325.0","41731.0","49856.0","9742.0",
   2004M01,"135048.0","3999.0","131049.0","91914.0","3257.0","35876.0","3999.0","1303.0","1904.0","789.0","131049.0","53969.0","64415.0","12663.0",
   2004M02,"136554.0","4268.0","132286.0","92586.0","3470.0","36233.0","4268.0","1346.0","2042.0","876.0","132286.0","52898.0","66598.0","12789.0",
   2004M03,"144743.0","4300.0","140443.0","98670.0","3634.0","38137.0","4300.0","1449.0","2040.0","805.0","140443.0","54743.0","72417.0","13280.0",
   2004M04,"125030.0","3616.0","121414.0","85190.0","2759.0","33464.0","3616.0","1152.0","1766.0","696.0","121414.0","46884.0","63510.0","11022.0",
   2004M05,"144539.0","4152.0","140387.0","98993.0","3832.0","37559.0","4152.0","1350.0","1923.0","875.0","140387.0","57147.0","70073.0","13164.0",
   2004M06,"144604.0","4155.0","140449.0","98239.0","3938.0","38267.0","4155.0","1413.0","2004.0","734.0","140449.0","57689.0","70065.0","12692.0",
   2004M07,"134913.0","3836.0","131077.0","93946.0","3323.0","33806.0","3836.0","1335.0","1772.0","723.0","131077.0","50368.0","69196.0","11511.0",
   2004M08,"118370.0","3380.0","114990.0","83484.0","2546.0","28953.0","3380.0","1172.0","1618.0","587.0","114990.0","45131.0","59373.0","10483.0",
   2004M09,"141770.0","4212.0","137558.0","98872.0","3416.0","35271.0","4212.0","1359.0","1934.0","913.0","137558.0","55042.0","70639.0","11881.0",
   2004M10,"128998.0","4119.0","124879.0","89592.0","3152.0","32139.0","4119.0","1271.0","1969.0","876.0","124879.0","47329.0","65744.0","11804.0",
   2004M11,"133264.0","3927.0","129337.0","92631.0","3767.0","32940.0","3927.0","1306.0","1867.0","745.0","129337.0","48406.0","68531.0","12393.0",
   2004M12,"120664.0","3801.0","116863.0","83547.0","2842.0","30481.0","3801.0","1354.0","1739.0","700.0","116863.0","44055.0","61475.0","11339.0",
   2005M01,"151018.0","4413.0","146605.0","104256.0","3548.0","38801.0","4413.0","1617.0","2035.0","758.0","146605.0","53801.0","77875.0","14933.0",
   2005M02,"146627.0","4104.0","142523.0","101882.0","3660.0","36981.0","4104.0","1334.0","2009.0","758.0","142523.0","51779.0","76635.0","14105.0",
   2005M03,"140240.0","4390.0","135850.0","97164.0","3534.0","35152.0","4390.0","1460.0","2209.0","717.0","135850.0","50412.0","71026.0","14419.0",
   2005M04,"154457.0","4535.0","149922.0","108238.0","3853.0","37831.0","4535.0","1378.0","2286.0","868.0","149922.0","56533.0","79074.0","14322.0",
   2005M05,"152622.0","4630.0","147992.0","108144.0","3495.0","36353.0","4630.0","1560.0","2136.0","932.0","147992.0","53972.0","78455.0","15565.0",
   2005M06,"162570.0","4574.0","157996.0","112619.0","4399.0","40978.0","4574.0","1505.0","2209.0","858.0","157996.0","56865.0","86051.0","15077.0",
   2005M07,"140366.0","3928.0","136438.0","97465.0","4720.0","34253.0","3928.0","1232.0","1937.0","754.0","136438.0","46798.0","76390.0","13252.0",
   2005M08,"132577.0","3940.0","128637.0","91499.0","2862.0","34276.0","3940.0","1243.0","1997.0","693.0","128637.0","47632.0","68807.0","12196.0",
   2005M09,"184936.0","4820.0","180116.0","129128.0","4806.0","46182.0","4820.0","1596.0","2337.0","884.0","180116.0","62547.0","99890.0","17678.0",
   2005M10,"145734.0","4471.0","141263.0","102511.0","4356.0","34396.0","4471.0","1284.0","2360.0","820.0","141263.0","49527.0","75987.0","15747.0",
   2005M11,"151218.0","4551.0","146667.0","107327.0","3602.0","35738.0","4551.0","1377.0","2215.0","955.0","146667.0","49483.0","78496.0","18696.0",
   2005M12,"136265.0","3707.0","132558.0","97380.0","3385.0","31793.0","3707.0","1215.0","1792.0","694.0","132558.0","45727.0","70320.0","16513.0",
   2006M01,"173677.0","4838.0","168839.0","124244.0","4004.0","40591.0","4838.0","1381.0","2286.0","1171.0","168839.0","55901.0","89106.0","23832.0",
   2006M02,"163741.0","4683.0","159058.0","114617.0","4998.0","39443.0","4683.0","1414.0","2175.0","1094.0","159058.0","54602.0","81186.0","23270.0",
   2006M03,"182682.0","5142.0","177540.0","127233.0","5818.0","44489.0","5142.0","1607.0","2419.0","1116.0","177540.0","57473.0","91623.0","28444.0",
   2006M04,"137455.0","3662.0","133793.0","97124.0","3560.0","33109.0","3662.0","1118.0","1755.0","789.0","133793.0","43876.0","71457.0","18460.0",
   2006M05,"177649.0","5111.0","172538.0","126137.0","4802.0","41599.0","5111.0","1466.0","2581.0","1064.0","172538.0","57352.0","95969.0","19217.0",
   2006M06,"172168.0","4553.0","167615.0","123081.0","4759.0","39775.0","4553.0","1292.0","2409.0","852.0","167615.0","56131.0","95250.0","16234.0",
   2006M07,"152550.0","4685.0","147865.0","107143.0","4491.0","36231.0","4685.0","1624.0","2356.0","705.0","147865.0","48065.0","87615.0","12185.0",
   2006M08,"138205.0","3876.0","134329.0","98384.0","4567.0","31378.0","3876.0","1221.0","1927.0","728.0","134329.0","44581.0","78845.0","10903.0",
   2006M09,"161212.0","4509.0","156703.0","114685.0","4701.0","37317.0","4509.0","1239.0","2527.0","743.0","156703.0","50946.0","92709.0","13048.0",
   2006M10,"157014.0","4567.0","152447.0","111393.0","4672.0","36382.0","4567.0","1396.0","2323.0","848.0","152447.0","50420.0","89444.0","12583.0",
   2006M11,"157466.0","4370.0","153096.0","111523.0","5047.0","36526.0","4370.0","1382.0","2236.0","752.0","153096.0","50299.0","89976.0","12821.0",
   2006M12,"122696.0","3594.0","119102.0","86607.0","3617.0","28878.0","3594.0","1147.0","1849.0","598.0","119102.0","38587.0","70993.0","9522.0",
   2007M01,"179612.0","4645.0","174967.0","124826.0","6102.0","44039.0","4645.0","1194.0","2539.0","912.0","174967.0","55345.0","105347.0","14275.0",
   2007M02,"154087.0","4081.0","150006.0","109769.0","5570.0","34667.0","4081.0","1272.0","2135.0","674.0","150006.0","48150.0","89353.0","12503.0",
   2007M03,"168948.0","4520.0","164428.0","116651.0","6812.0","40965.0","4520.0","1385.0","2403.0","732.0","164428.0","50099.0","100449.0","13880.0",
   2007M04,"139850.0","3918.0","135932.0","97492.0","4786.0","33654.0","3918.0","1342.0","1993.0","583.0","135932.0","41367.0","83014.0","11551.0",
   2007M05,"169905.0","4826.0","165079.0","118669.0","6905.0","39505.0","4826.0","1488.0","2515.0","823.0","165079.0","51356.0","98389.0","15334.0",
   2007M06,"155584.0","4300.0","151284.0","111139.0","4785.0","35360.0","4300.0","1541.0","2037.0","722.0","151284.0","48579.0","88876.0","13829.0",
   2007M07,"149281.0","4015.0","145266.0","104808.0","4585.0","35873.0","4015.0","1216.0","2066.0","733.0","145266.0","45335.0","87187.0","12744.0",
   2007M08,"129961.0","3558.0","126403.0","90763.0","4401.0","31239.0","3558.0","1193.0","1728.0","637.0","126403.0","40819.0","74756.0","10828.0",
   2007M09,"145326.0","4258.0","141068.0","102131.0","5338.0","33599.0","4258.0","1394.0","2206.0","658.0","141068.0","46131.0","83083.0","11854.0",
   2007M10,"145007.0","4546.0","140461.0","97586.0","4558.0","38317.0","4546.0","1402.0","2392.0","752.0","140461.0","44123.0","82756.0","13582.0",
   2007M11,"139891.0","3838.0","136053.0","93262.0","4388.0","38403.0","3838.0","1249.0","1840.0","749.0","136053.0","43537.0","80241.0","12275.0",
   2007M12,"103175.0","2540.0","100635.0","71794.0","3419.0","25422.0","2540.0","706.0","1326.0","508.0","100635.0","31269.0","59878.0","9488.0",
   2008M01,"138301.0","3774.0","134527.0","93838.0","4820.0","35869.0","3774.0","997.0","2086.0","691.0","134527.0","41964.0","79349.0","13214.0",
   2008M02,"124191.0","3736.0","120455.0","81997.0","4425.0","34033.0","3736.0","1089.0","1881.0","766.0","120455.0","40175.0","68445.0","11835.0",
   2008M03,"104690.0","2724.0","101966.0","70210.0","3517.0","28239.0","2724.0","926.0","1370.0","428.0","101966.0","33929.0","58145.0","9892.0",
   2008M04,"124634.0","3769.0","120865.0","86127.0","3811.0","30927.0","3769.0","1080.0","1857.0","832.0","120865.0","38316.0","71130.0","11419.0",
   2008M05,"114028.0","3270.0","110758.0","77157.0","4432.0","29169.0","3270.0","1012.0","1511.0","747.0","110758.0","40939.0","59207.0","10612.0",
   2008M06,"105301.0","3048.0","102253.0","68475.0","5046.0","28732.0","3048.0","975.0","1434.0","639.0","102253.0","35821.0","57190.0","9242.0",
   2008M07,"114610.0","3585.0","111025.0","72813.0","5058.0","33154.0","3585.0","1370.0","1570.0","645.0","111025.0","38217.0","63494.0","9314.0",
   2008M08,"87840.0","4407.0","83433.0","56020.0","3129.0","24284.0","4407.0","1206.0","2516.0","685.0","83433.0","29598.0","44971.0","8864.0",
   2008M09,"103312.0","4335.0","98977.0","66239.0","5032.0","27706.0","4335.0","1613.0","1802.0","920.0","98977.0","38413.0","51347.0","9217.0",
   2008M10,"102715.0","4964.0","97751.0","63949.0","4905.0","28897.0","4964.0","2119.0","1872.0","973.0","97751.0","34095.0","55066.0","8590.0",
   2008M11,"80535.0","3824.0","76711.0","51104.0","3498.0","22109.0","3824.0","1393.0","1689.0","742.0","76711.0","28839.0","39642.0","8230.0",
   2008M12,"83217.0","3473.0","79744.0","48490.0","3475.0","27779.0","3473.0","1131.0","1595.0","747.0","79744.0","28475.0","43958.0","7311.0",
   2009M01,"85542.0","4001.0","81541.0","52547.0","4135.0","24859.0","4001.0","1438.0","1711.0","852.0","81541.0","27918.0","45988.0","7635.0",
   2009M02,"86946.0","4242.0","82704.0","50535.0","5155.0","27014.0","4242.0","1559.0","1774.0","909.0","82704.0","30346.0","44735.0","7623.0",
   2009M03,"88735.0","4227.0","84508.0","52268.0","4643.0","27597.0","4227.0","1638.0","1633.0","956.0","84508.0","29613.0","46605.0","8290.0",
   2009M04,"82974.0","5356.0","77618.0","50266.0","4356.0","22996.0","5356.0","2007.0","2331.0","1018.0","77618.0","28772.0","41649.0","7197.0",
   2009M05,"96102.0","5030.0","91072.0","57438.0","4897.0","28737.0","5030.0","1943.0","2217.0","870.0","91072.0","33240.0","49444.0","8388.0",
   2009M06,"100074.0","5000.0","95074.0","61832.0","4883.0","28359.0","5000.0","1890.0","2058.0","1052.0","95074.0","34889.0","49778.0","10407.0",
   2009M07,"100149.0","5477.0","94672.0","59605.0","4264.0","30803.0","5477.0","1985.0","2454.0","1038.0","94672.0","35338.0","49089.0","10245.0",
   2009M08,"83912.0","4782.0","79130.0","51970.0","3811.0","23349.0","4782.0","2021.0","1906.0","855.0","79130.0","29957.0","40601.0","8572.0",
   2009M09,"104748.0","5885.0","98863.0","62971.0","6612.0","29280.0","5885.0","2072.0","2548.0","1265.0","98863.0","37658.0","51355.0","9850.0",
   2009M10,"89873.0","5491.0","84382.0","52250.0","3963.0","28169.0","5491.0","1986.0","2286.0","1219.0","84382.0","30060.0","45739.0","8583.0",
   2009M11,"82913.0","4539.0","78374.0","51769.0","3572.0","23033.0","4539.0","1453.0","1981.0","1105.0","78374.0","28842.0","41463.0","8069.0",
   2009M12,"80619.0","4634.0","75985.0","47438.0","2977.0","25570.0","4634.0","1541.0","1931.0","1162.0","75985.0","27845.0","40299.0","7841.0",
   2010M01,"90045.0","4581.0","85464.0","53898.0","3656.0","27910.0","4581.0","1730.0","1920.0","931.0","85464.0","30633.0","46131.0","8700.0",
   2010M02,"88523.0","4472.0","84051.0","55194.0","3825.0","25032.0","4472.0","1448.0","2078.0","946.0","84051.0","31692.0","43561.0","8798.0",
   2010M03,"87137.0","4465.0","82672.0","54135.0","3488.0","25049.0","4465.0","1358.0","1873.0","1234.0","82672.0","31649.0","42387.0","8636.0",
   2010M04,"80182.0","3721.0","76461.0","50779.0","3129.0","22553.0","3721.0","1212.0","1549.0","960.0","76461.0","29042.0","39357.0","8062.0",
   2010M05,"87882.0","3942.0","83940.0","55489.0","3061.0","25390.0","3942.0","1193.0","1726.0","1023.0","83940.0","31260.0","44325.0","8355.0",
   2010M06,"89140.0","3931.0","85209.0","56734.0","2957.0","25518.0","3931.0","1335.0","1756.0","840.0","85209.0","31889.0","44762.0","8558.0",
   2010M07,"84218.0","3516.0","80702.0","55709.0","2296.0","22697.0","3516.0","1234.0","1413.0","869.0","80702.0","30589.0","42245.0","7868.0",
   2010M08,"77256.0","3276.0","73980.0","50142.0","3093.0","20745.0","3276.0","1084.0","1446.0","746.0","73980.0","28952.0","37641.0","7387.0",
   2010M09,"83330.0","4288.0","79042.0","53127.0","3815.0","22100.0","4288.0","1410.0","1765.0","1113.0","79042.0","31488.0","39746.0","7808.0",
   2010M10,"62109.0","3129.0","58980.0","39326.0","2398.0","17256.0","3129.0","828.0","1466.0","835.0","58980.0","21363.0","30913.0","6704.0",
   2010M11,"67086.0","3130.0","63956.0","43797.0","2460.0","17699.0","3130.0","1028.0","1276.0","826.0","63956.0","23234.0","33001.0","7721.0",
   2010M12,"64040.0","2436.0","61604.0","39205.0","2265.0","20134.0","2436.0","701.0","1063.0","672.0","61604.0","23739.0","30458.0","7407.0",
   2011M01,"75409.0","3660.0","71749.0","49510.0","2145.0","20094.0","3660.0","1194.0","1344.0","1122.0","71749.0","25636.0","37602.0","8511.0",
   2011M02,"76398.0","3012.0","73386.0","49892.0","2538.0","20956.0","3012.0","984.0","1257.0","771.0","73386.0","27440.0","37463.0","8483.0",
   2011M03,"68917.0","3134.0","65783.0","42982.0","2323.0","20478.0","3134.0","915.0","1078.0","1141.0","65783.0","25344.0","32548.0","7891.0",
   2011M04,"49618.0","2382.0","47236.0","31275.0","2170.0","13791.0","2382.0","887.0","839.0","656.0","47236.0","17793.0","23505.0","5938.0",
       2011M05,"60341.0","2919.0","57422.0","37440.0","2647.0","17335.0","2919.0","888.0","1234.0","797.0","57422.0","20844.0","29009.0","7569.0",
   2011M06,"52225.0","2473.0","49752.0","32533.0","2188.0","15031.0","2473.0","685.0","1007.0","781.0","49752.0","19024.0","23669.0","7059.0",
   2011M07,"46748.0","2281.0","44467.0","29458.0","2054.0","12955.0","2281.0","699.0","828.0","754.0","44467.0","16705.0","22269.0","5493.0",
   2011M08,"47620.0","2558.0","45062.0","29502.0","1724.0","13836.0","2558.0","982.0","929.0","647.0","45062.0","18831.0","19828.0","6403.0",
   2011M09,"51033.0","2662.0","48371.0","31284.0","2133.0","14954.0","2662.0","959.0","842.0","861.0","48371.0","24327.0","17771.0","6273.0",
   2011M10,"39178.0","2584.0","36594.0","22317.0","1808.0","12469.0","2584.0","762.0","1137.0","685.0","36594.0","19058.0","12760.0","4776.0",
   2011M11,"45581.0","2232.0","43349.0","27938.0","2005.0","13406.0","2232.0","983.0","493.0","756.0","43349.0","24871.0","11938.0","6540.0",
   2011M12,"38691.0","1896.0","36795.0","24330.0","1623.0","10842.0","1896.0","864.0","360.0","672.0","36795.0","23729.0","8104.0","4962.0",
   2012M01,"46821.0","2593.0","44228.0","29035.0","1906.0","13287.0","2593.0","1203.0","398.0","992.0","44228.0","28955.0","8600.0","6673.0",
   2012M02,"43616.0","2947.0","40669.0","26169.0","2190.0","12310.0","2947.0","2015.0","304.0","628.0","40669.0","26652.0","7227.0","6790.0",
   2012M03,"42367.0","2448.0","39919.0","24679.0","2566.0","12674.0","2448.0","1426.0","229.0","793.0","39919.0","28454.0","5645.0","5820.0",
   2012M04,"36266.0","2013.0","34253.0","21498.0","1594.0","11161.0","2013.0","1092.0","169.0","752.0","34253.0","24893.0","4033.0","5327.0",
   2012M05,"43955.0","2699.0","41256.0","26007.0","2077.0","13172.0","2699.0","1619.0","175.0","905.0","41256.0","30798.0","4328.0","6130.0",
   2012M06,"41143.0","1998.0","39145.0","24321.0","1616.0","13208.0","1998.0","1154.0","242.0","602.0","39145.0","29832.0","3958.0","5355.0",
   2012M07,"42089.0","2160.0","39929.0","24291.0","1404.0","14234.0","2160.0","1159.0","211.0","790.0","39929.0","30123.0","4094.0","5712.0",
   2012M08,"35111.0","2061.0","33050.0","21106.0","1369.0","10575.0","2061.0","1075.0","187.0","799.0","33050.0","23940.0","3463.0","5647.0",
   2012M09,"35894.0","2224.0","33670.0","21195.0","1085.0","11390.0","2224.0","1394.0","190.0","640.0","33670.0","26310.0","3096.0","4264.0",
   2012M10,"31405.0","2022.0","29383.0","19105.0","1531.0","8747.0","2022.0","948.0","228.0","846.0","29383.0","21079.0","3199.0","5105.0",
   2012M11,"31697.0","1820.0","29877.0","19115.0","1067.0","9695.0","1820.0","794.0","162.0","864.0","29877.0","22420.0","2647.0","4810.0",
   2012M12,"28573.0","1509.0","27064.0","17577.0","748.0","8739.0","1509.0","691.0","156.0","662.0","27064.0","19885.0","2599.0","4580.0",
   2013M01,"41365.0","1827.0","39538.0","25447.0","1148.0","12943.0","1827.0","943.0","181.0","703.0","39538.0","29295.0","3954.0","6289.0",
   2013M02,"37656.0","1863.0","35793.0","24197.0","1398.0","10198.0","1863.0","818.0","171.0","874.0","35793.0","26463.0","3372.0","5958.0",
   2013M03,"27525.0","1637.0","25888.0","16270.0","902.0","8716.0","1637.0","949.0","148.0","540.0","25888.0","19491.0","2372.0","4025.0",
    Capital loaned,"","","","","","","","","","","","","","",
       2003M01,"11135.75","444.5","10691.25","7937.54","1134.3","1619.4","444.5","131.16","222.83","90.51","10691.25","4287.19","5525.87","878.22",
       2003M02,"12017.24","534.55","11482.69","8223.45","1194.4","2064.78","534.55","216.91","250.43","67.22","11482.69","4664.59","5855.24","962.87","957.07","518.29","199.47","202.31","116.51","7728.28","3170.91","3704.87","852.5",

And so on.

如您所见,有两个空行:

    Number,"","","","","","","","","","","","","","",
    Capital loaned,"","","","","","","","","","","","","","",

这些行使我无法成功导入该系列,因为我的索引中最终出现了“数字”和“借出的资本”,与一堆 nan 相关联。我也有重复的日期。

我想应该有一种方法可以用那些应该是列的行来构建组。另一种解决方案(在我的情况下是最好的)是从这个 csv 中获取两个 pandas 系列。任何想法?

4

1 回答 1

0

Try the following to skip the next line after the header

output = pandas.read_csv(csv,header=7, sep=',', skip_footer=11, 
                          skiprows=[0,1,2,3,4,5,6,8], parse_dates=True,
                          index_col=0)
于 2013-04-25T19:03:03.850 回答