2017-09-19 2 views
0

J'ai un dataframe Pandas avec multiindice, comme suit:Récupération d'une tranche d'un dataframe multiindexed

enter image description here

Je suis en train de récupérer quelques lignes à l'aide d'un IndexSlice:

idx=pd.IndexSlice 
prices.loc[idx[["2016-09-19 13:30:00":"2016-09-19 14:30:00"],"Chinese Renminbioffshore"],:] 

Mais je erreur de réception:

SyntaxError: invalid syntax 

Selon the documentation (scroll to in:72), Je devrais être capable de faire ça.

Quelqu'un a une suggestion?

Voici les données pour recréer les dataframe:

EDIT: il semble que je ne peux pas poster les données pour recréer cette dataframe car elle rend la proportion de la question à la recherche comme le code est trop grand pour SO ... Si tout va bien ce problème est encore résoluble.

EDIT2: Peut-être que le poster comme ça serait utile?

{'ID': {(Timestamp('2016-09-19 13:30:00'), '10 Year US Treasury Note'): 6211, 
    (Timestamp('2016-09-19 13:30:00'), '30 Day Fed Funds'): 37585, 
    (Timestamp('2016-09-19 13:30:00'), 'Bloomberg Commodity Index'): 3757, 
    (Timestamp('2016-09-19 13:30:00'), 'E-mini S&P 500'): 1, 
    (Timestamp('2016-09-19 13:30:00'), 'Gold'): 33824, 
    (Timestamp('2016-09-19 13:30:00'), 'Henry Hub Natural Gas'): 41328, 
    (Timestamp('2016-09-19 13:30:00'), 'Lean Hogs'): 9971, 
    (Timestamp('2016-09-19 13:30:00'), 'Light Sweet Crude Oil'): 45089, 
    (Timestamp('2016-09-19 13:30:00'), 'Live Cattle'): 21274, 
    (Timestamp('2016-09-19 13:30:00'), 'NYMEX Copper Index'): 30063, 
    (Timestamp('2016-09-19 13:30:00'), 'NYMEX Palladium Index'): 17513, 
    (Timestamp('2016-09-19 13:30:00'), 'NYMEX Platinum Index'): 26302, 
    (Timestamp('2016-09-19 13:30:00'), 'Soybean Meal Futures'): 23788, 
    (Timestamp('2016-09-19 13:30:00'), 'Soybean Oil Futures'): 14999, 
    (Timestamp('2016-09-19 13:30:00'), 'Wheat Futures'): 12485, 
    (Timestamp('2016-09-19 14:00:00'), '10 Year US Treasury Note'): 6212, 
    (Timestamp('2016-09-19 14:00:00'), '30 Day Fed Funds'): 37586, 
    (Timestamp('2016-09-19 14:00:00'), 'Bloomberg Commodity Index'): 3758, 
    (Timestamp('2016-09-19 14:00:00'), 'E-mini S&P 500'): 2, 
    (Timestamp('2016-09-19 14:00:00'), 'Gold'): 33825, 
    (Timestamp('2016-09-19 14:00:00'), 'Henry Hub Natural Gas'): 41329, 
    (Timestamp('2016-09-19 14:00:00'), 'Lean Hogs'): 9972, 
    (Timestamp('2016-09-19 14:00:00'), 'Light Sweet Crude Oil'): 45090, 
    (Timestamp('2016-09-19 14:00:00'), 'Live Cattle'): 21275, 
    (Timestamp('2016-09-19 14:00:00'), 'NYMEX Copper Index'): 30064, 
    (Timestamp('2016-09-19 14:00:00'), 'NYMEX Palladium Index'): 17514, 
    (Timestamp('2016-09-19 14:00:00'), 'NYMEX Platinum Index'): 26303, 
    (Timestamp('2016-09-19 14:00:00'), 'Soybean Meal Futures'): 23789, 
    (Timestamp('2016-09-19 14:00:00'), 'Soybean Oil Futures'): 15000, 
    (Timestamp('2016-09-19 14:00:00'), 'Wheat Futures'): 12486, 
    (Timestamp('2016-09-19 14:30:00'), '10 Year US Treasury Note'): 6213, 
    (Timestamp('2016-09-19 14:30:00'), '30 Day Fed Funds'): 37587, 
    (Timestamp('2016-09-19 14:30:00'), 'Bloomberg Commodity Index'): 3759, 
    (Timestamp('2016-09-19 14:30:00'), 'E-mini S&P 500'): 3, 
    (Timestamp('2016-09-19 14:30:00'), 'Gold'): 33826, 
    (Timestamp('2016-09-19 14:30:00'), 'Henry Hub Natural Gas'): 41330, 
    (Timestamp('2016-09-19 14:30:00'), 'Lean Hogs'): 9973, 
    (Timestamp('2016-09-19 14:30:00'), 'Light Sweet Crude Oil'): 45091, 
    (Timestamp('2016-09-19 14:30:00'), 'Live Cattle'): 21276, 
    (Timestamp('2016-09-19 14:30:00'), 'NYMEX Copper Index'): 30065, 
    (Timestamp('2016-09-19 14:30:00'), 'NYMEX Palladium Index'): 17515, 
    (Timestamp('2016-09-19 14:30:00'), 'NYMEX Platinum Index'): 26304, 
    (Timestamp('2016-09-19 14:30:00'), 'Soybean Meal Futures'): 23790, 
    (Timestamp('2016-09-19 14:30:00'), 'Soybean Oil Futures'): 15001, 
    (Timestamp('2016-09-19 14:30:00'), 'Wheat Futures'): 12487, 
    (Timestamp('2016-09-19 15:00:00'), '10 Year US Treasury Note'): 6214, 
    (Timestamp('2016-09-19 15:00:00'), '30 Day Fed Funds'): 37588, 
    (Timestamp('2016-09-19 15:00:00'), 'Bloomberg Commodity Index'): 3760, 
    (Timestamp('2016-09-19 15:00:00'), 'E-mini S&P 500'): 4, 
    (Timestamp('2016-09-19 15:00:00'), 'Gold'): 33827}, 
'close': {(Timestamp('2016-09-19 13:30:00'), 
    '10 Year US Treasury Note'): 128.671875, 
    (Timestamp('2016-09-19 13:30:00'), '30 Day Fed Funds'): 98.879999999999995, 
    (Timestamp('2016-09-19 13:30:00'), 
    'Bloomberg Commodity Index'): 84.900000000000006, 
    (Timestamp('2016-09-19 13:30:00'), 'E-mini S&P 500'): 2132.0, 
    (Timestamp('2016-09-19 13:30:00'), 'Gold'): 1339.4000000000001, 
    (Timestamp('2016-09-19 13:30:00'), 
    'Henry Hub Natural Gas'): 4.8360000000000003, 
    (Timestamp('2016-09-19 13:30:00'), 'Lean Hogs'): 55.774999999999999, 
    (Timestamp('2016-09-19 13:30:00'), 
    'Light Sweet Crude Oil'): 49.420000000000002, 
    (Timestamp('2016-09-19 13:30:00'), 'Live Cattle'): 97.224999999999994, 
    (Timestamp('2016-09-19 13:30:00'), 'NYMEX Copper Index'): 2.2149999999999999, 
    (Timestamp('2016-09-19 13:30:00'), 
    'NYMEX Palladium Index'): 684.29999999999995, 
    (Timestamp('2016-09-19 13:30:00'), 'NYMEX Platinum Index'): 1036.0, 
    (Timestamp('2016-09-19 13:30:00'), 
    'Soybean Meal Futures'): 336.30000000000001, 
    (Timestamp('2016-09-19 13:30:00'), 
    'Soybean Oil Futures'): 34.460000000000001, 
    (Timestamp('2016-09-19 13:30:00'), 'Wheat Futures'): 497.0, 
    (Timestamp('2016-09-19 14:00:00'), '10 Year US Treasury Note'): 128.609375, 
    (Timestamp('2016-09-19 14:00:00'), '30 Day Fed Funds'): 98.885000000000005, 
    (Timestamp('2016-09-19 14:00:00'), 
    'Bloomberg Commodity Index'): 85.099999999999994, 
    (Timestamp('2016-09-19 14:00:00'), 'E-mini S&P 500'): 2131.0, 
    (Timestamp('2016-09-19 14:00:00'), 'Gold'): 1339.0999999999999, 
    (Timestamp('2016-09-19 14:00:00'), 
    'Henry Hub Natural Gas'): 4.8179999999999996, 
    (Timestamp('2016-09-19 14:00:00'), 'Lean Hogs'): 55.174999999999997, 
    (Timestamp('2016-09-19 14:00:00'), 
    'Light Sweet Crude Oil'): 49.719999999999999, 
    (Timestamp('2016-09-19 14:00:00'), 'Live Cattle'): 97.275000000000006, 
    (Timestamp('2016-09-19 14:00:00'), 'NYMEX Copper Index'): 2.2145000000000001, 
    (Timestamp('2016-09-19 14:00:00'), 
    'NYMEX Palladium Index'): 692.39999999999998, 
    (Timestamp('2016-09-19 14:00:00'), 'NYMEX Platinum Index'): 1039.0, 
    (Timestamp('2016-09-19 14:00:00'), 'Soybean Meal Futures'): 335.0, 
    (Timestamp('2016-09-19 14:00:00'), 'Soybean Oil Futures'): 34.5, 
    (Timestamp('2016-09-19 14:00:00'), 'Wheat Futures'): 494.25, 
    (Timestamp('2016-09-19 14:30:00'), '10 Year US Treasury Note'): 128.609375, 
    (Timestamp('2016-09-19 14:30:00'), '30 Day Fed Funds'): 98.885000000000005, 
    (Timestamp('2016-09-19 14:30:00'), 
    'Bloomberg Commodity Index'): 85.099999999999994, 
    (Timestamp('2016-09-19 14:30:00'), 'E-mini S&P 500'): 2128.0, 
    (Timestamp('2016-09-19 14:30:00'), 'Gold'): 1338.2, 
    (Timestamp('2016-09-19 14:30:00'), 
    'Henry Hub Natural Gas'): 4.8179999999999996, 
    (Timestamp('2016-09-19 14:30:00'), 'Lean Hogs'): 55.024999999999999, 
    (Timestamp('2016-09-19 14:30:00'), 
    'Light Sweet Crude Oil'): 49.689999999999998, 
    (Timestamp('2016-09-19 14:30:00'), 'Live Cattle'): 97.125, 
    (Timestamp('2016-09-19 14:30:00'), 'NYMEX Copper Index'): 2.2145000000000001, 
    (Timestamp('2016-09-19 14:30:00'), 
    'NYMEX Palladium Index'): 688.79999999999995, 
    (Timestamp('2016-09-19 14:30:00'), 'NYMEX Platinum Index'): 1040.0, 
    (Timestamp('2016-09-19 14:30:00'), 
    'Soybean Meal Futures'): 333.19999999999999, 
    (Timestamp('2016-09-19 14:30:00'), 
    'Soybean Oil Futures'): 34.530000000000001, 
    (Timestamp('2016-09-19 14:30:00'), 'Wheat Futures'): 491.25, 
    (Timestamp('2016-09-19 15:00:00'), '10 Year US Treasury Note'): 128.640625, 
    (Timestamp('2016-09-19 15:00:00'), '30 Day Fed Funds'): 98.885000000000005, 
    (Timestamp('2016-09-19 15:00:00'), 
    'Bloomberg Commodity Index'): 85.099999999999994, 
    (Timestamp('2016-09-19 15:00:00'), 'E-mini S&P 500'): 2129.0, 
    (Timestamp('2016-09-19 15:00:00'), 'Gold'): 1338.2}, 
'high': {(Timestamp('2016-09-19 13:30:00'), 
    '10 Year US Treasury Note'): 128.703125, 
    (Timestamp('2016-09-19 13:30:00'), '30 Day Fed Funds'): 98.879999999999995, 
    (Timestamp('2016-09-19 13:30:00'), 
    'Bloomberg Commodity Index'): 84.900000000000006, 
    (Timestamp('2016-09-19 13:30:00'), 'E-mini S&P 500'): 2133.0, 
    (Timestamp('2016-09-19 13:30:00'), 'Gold'): 1341.2, 
    (Timestamp('2016-09-19 13:30:00'), 
    'Henry Hub Natural Gas'): 4.8529999999999998, 
    (Timestamp('2016-09-19 13:30:00'), 'Lean Hogs'): 56.149999999999999, 
    (Timestamp('2016-09-19 13:30:00'), 'Light Sweet Crude Oil'): 49.5, 
    (Timestamp('2016-09-19 13:30:00'), 'Live Cattle'): 97.724999999999994, 
    (Timestamp('2016-09-19 13:30:00'), 'NYMEX Copper Index'): 2.2200000000000002, 
    (Timestamp('2016-09-19 13:30:00'), 
    'NYMEX Palladium Index'): 684.79999999999995, 
    (Timestamp('2016-09-19 13:30:00'), 'NYMEX Platinum Index'): 1039.0, 
    (Timestamp('2016-09-19 13:30:00'), 
    'Soybean Meal Futures'): 339.30000000000001, 
    (Timestamp('2016-09-19 13:30:00'), 
    'Soybean Oil Futures'): 34.469999999999999, 
    (Timestamp('2016-09-19 13:30:00'), 'Wheat Futures'): 498.25, 
    (Timestamp('2016-09-19 14:00:00'), '10 Year US Treasury Note'): 128.71875, 
    (Timestamp('2016-09-19 14:00:00'), '30 Day Fed Funds'): 98.885000000000005, 
    (Timestamp('2016-09-19 14:00:00'), 
    'Bloomberg Commodity Index'): 85.099999999999994, 
    (Timestamp('2016-09-19 14:00:00'), 'E-mini S&P 500'): 2134.0, 
    (Timestamp('2016-09-19 14:00:00'), 'Gold'): 1340.2, 
    (Timestamp('2016-09-19 14:00:00'), 
    'Henry Hub Natural Gas'): 4.8410000000000002, 
    (Timestamp('2016-09-19 14:00:00'), 'Lean Hogs'): 55.774999999999999, 
    (Timestamp('2016-09-19 14:00:00'), 
    'Light Sweet Crude Oil'): 49.920000000000002, 
    (Timestamp('2016-09-19 14:00:00'), 'Live Cattle'): 97.400000000000006, 
    (Timestamp('2016-09-19 14:00:00'), 'NYMEX Copper Index'): 2.2164999999999999, 
    (Timestamp('2016-09-19 14:00:00'), 'NYMEX Palladium Index'): 693.75, 
    (Timestamp('2016-09-19 14:00:00'), 'NYMEX Platinum Index'): 1041.0, 
    (Timestamp('2016-09-19 14:00:00'), 'Soybean Meal Futures'): 336.5, 
    (Timestamp('2016-09-19 14:00:00'), 
    'Soybean Oil Futures'): 34.609999999999999, 
    (Timestamp('2016-09-19 14:00:00'), 'Wheat Futures'): 497.25, 
    (Timestamp('2016-09-19 14:30:00'), '10 Year US Treasury Note'): 128.640625, 
    (Timestamp('2016-09-19 14:30:00'), '30 Day Fed Funds'): 98.885000000000005, 
    (Timestamp('2016-09-19 14:30:00'), 
    'Bloomberg Commodity Index'): 85.099999999999994, 
    (Timestamp('2016-09-19 14:30:00'), 'E-mini S&P 500'): 2131.0, 
    (Timestamp('2016-09-19 14:30:00'), 'Gold'): 1339.7, 
    (Timestamp('2016-09-19 14:30:00'), 
    'Henry Hub Natural Gas'): 4.8220000000000001, 
    (Timestamp('2016-09-19 14:30:00'), 'Lean Hogs'): 55.375, 
    (Timestamp('2016-09-19 14:30:00'), 
    'Light Sweet Crude Oil'): 49.880000000000003, 
    (Timestamp('2016-09-19 14:30:00'), 'Live Cattle'): 97.200000000000003, 
    (Timestamp('2016-09-19 14:30:00'), 'NYMEX Copper Index'): 2.2155, 
    (Timestamp('2016-09-19 14:30:00'), 
    'NYMEX Palladium Index'): 692.79999999999995, 
    (Timestamp('2016-09-19 14:30:00'), 'NYMEX Platinum Index'): 1041.0, 
    (Timestamp('2016-09-19 14:30:00'), 'Soybean Meal Futures'): 335.0, 
    (Timestamp('2016-09-19 14:30:00'), 'Soybean Oil Futures'): 34.57, 
    (Timestamp('2016-09-19 14:30:00'), 'Wheat Futures'): 494.5, 
    (Timestamp('2016-09-19 15:00:00'), '10 Year US Treasury Note'): 128.65625, 
    (Timestamp('2016-09-19 15:00:00'), '30 Day Fed Funds'): 98.885000000000005, 
    (Timestamp('2016-09-19 15:00:00'), 
    'Bloomberg Commodity Index'): 85.099999999999994, 
    (Timestamp('2016-09-19 15:00:00'), 'E-mini S&P 500'): 2130.0, 
    (Timestamp('2016-09-19 15:00:00'), 'Gold'): 1338.8}, 
'low': {(Timestamp('2016-09-19 13:30:00'), 
    '10 Year US Treasury Note'): 128.625, 
    (Timestamp('2016-09-19 13:30:00'), '30 Day Fed Funds'): 98.879999999999995, 
    (Timestamp('2016-09-19 13:30:00'), 
    'Bloomberg Commodity Index'): 84.900000000000006, 
    (Timestamp('2016-09-19 13:30:00'), 'E-mini S&P 500'): 2125.0, 
    (Timestamp('2016-09-19 13:30:00'), 'Gold'): 1338.7, 
    (Timestamp('2016-09-19 13:30:00'), 
    'Henry Hub Natural Gas'): 4.8029999999999999, 
    (Timestamp('2016-09-19 13:30:00'), 'Lean Hogs'): 55.100000000000001, 
    (Timestamp('2016-09-19 13:30:00'), 
    'Light Sweet Crude Oil'): 49.039999999999999, 
    (Timestamp('2016-09-19 13:30:00'), 'Live Cattle'): 96.900000000000006, 
    (Timestamp('2016-09-19 13:30:00'), 'NYMEX Copper Index'): 2.2134999999999998, 
    (Timestamp('2016-09-19 13:30:00'), 
    'NYMEX Palladium Index'): 681.79999999999995, 
    (Timestamp('2016-09-19 13:30:00'), 'NYMEX Platinum Index'): 1034.0, 
    (Timestamp('2016-09-19 13:30:00'), 
    'Soybean Meal Futures'): 336.10000000000002, 
    (Timestamp('2016-09-19 13:30:00'), 
    'Soybean Oil Futures'): 34.270000000000003, 
    (Timestamp('2016-09-19 13:30:00'), 'Wheat Futures'): 493.25, 
    (Timestamp('2016-09-19 14:00:00'), '10 Year US Treasury Note'): 128.59375, 
    (Timestamp('2016-09-19 14:00:00'), '30 Day Fed Funds'): 98.879999999999995, 
    (Timestamp('2016-09-19 14:00:00'), 
    'Bloomberg Commodity Index'): 85.099999999999994, 
    (Timestamp('2016-09-19 14:00:00'), 'E-mini S&P 500'): 2130.0, 
    (Timestamp('2016-09-19 14:00:00'), 'Gold'): 1338.5999999999999, 
    (Timestamp('2016-09-19 14:00:00'), 
    'Henry Hub Natural Gas'): 4.8129999999999997, 
    (Timestamp('2016-09-19 14:00:00'), 'Lean Hogs'): 55.125, 
    (Timestamp('2016-09-19 14:00:00'), 
    'Light Sweet Crude Oil'): 49.240000000000002, 
    (Timestamp('2016-09-19 14:00:00'), 'Live Cattle'): 96.849999999999994, 
    (Timestamp('2016-09-19 14:00:00'), 'NYMEX Copper Index'): 2.2094999999999998, 
    (Timestamp('2016-09-19 14:00:00'), 
    'NYMEX Palladium Index'): 683.85000000000002, 
    (Timestamp('2016-09-19 14:00:00'), 'NYMEX Platinum Index'): 1036.0, 
    (Timestamp('2016-09-19 14:00:00'), 
    'Soybean Meal Futures'): 334.69999999999999, 
    (Timestamp('2016-09-19 14:00:00'), 
    'Soybean Oil Futures'): 34.450000000000003, 
    (Timestamp('2016-09-19 14:00:00'), 'Wheat Futures'): 494.25, 
    (Timestamp('2016-09-19 14:30:00'), '10 Year US Treasury Note'): 128.546875, 
    (Timestamp('2016-09-19 14:30:00'), '30 Day Fed Funds'): 98.885000000000005, 
    (Timestamp('2016-09-19 14:30:00'), 
    'Bloomberg Commodity Index'): 85.099999999999994, 
    (Timestamp('2016-09-19 14:30:00'), 'E-mini S&P 500'): 2127.0, 
    (Timestamp('2016-09-19 14:30:00'), 'Gold'): 1337.5999999999999, 
    (Timestamp('2016-09-19 14:30:00'), 
    'Henry Hub Natural Gas'): 4.8019999999999996, 
    (Timestamp('2016-09-19 14:30:00'), 'Lean Hogs'): 54.875, 
    (Timestamp('2016-09-19 14:30:00'), 
    'Light Sweet Crude Oil'): 49.560000000000002, 
    (Timestamp('2016-09-19 14:30:00'), 'Live Cattle'): 96.799999999999997, 
    (Timestamp('2016-09-19 14:30:00'), 'NYMEX Copper Index'): 2.2134999999999998, 
    (Timestamp('2016-09-19 14:30:00'), 
    'NYMEX Palladium Index'): 688.60000000000002, 
    (Timestamp('2016-09-19 14:30:00'), 'NYMEX Platinum Index'): 1039.0, 
    (Timestamp('2016-09-19 14:30:00'), 'Soybean Meal Futures'): 333.0, 
    (Timestamp('2016-09-19 14:30:00'), 
    'Soybean Oil Futures'): 34.479999999999997, 
    (Timestamp('2016-09-19 14:30:00'), 'Wheat Futures'): 490.25, 
    (Timestamp('2016-09-19 15:00:00'), '10 Year US Treasury Note'): 128.59375, 
    (Timestamp('2016-09-19 15:00:00'), '30 Day Fed Funds'): 98.885000000000005, 
    (Timestamp('2016-09-19 15:00:00'), 
    'Bloomberg Commodity Index'): 85.099999999999994, 
    (Timestamp('2016-09-19 15:00:00'), 'E-mini S&P 500'): 2127.0, 
    (Timestamp('2016-09-19 15:00:00'), 'Gold'): 1337.7}, 
'open': {(Timestamp('2016-09-19 13:30:00'), 
    '10 Year US Treasury Note'): 128.6875, 
    (Timestamp('2016-09-19 13:30:00'), '30 Day Fed Funds'): 98.879999999999995, 
    (Timestamp('2016-09-19 13:30:00'), 
    'Bloomberg Commodity Index'): 84.900000000000006, 
    (Timestamp('2016-09-19 13:30:00'), 'E-mini S&P 500'): 2126.0, 
    (Timestamp('2016-09-19 13:30:00'), 'Gold'): 1341.2, 
    (Timestamp('2016-09-19 13:30:00'), 
    'Henry Hub Natural Gas'): 4.8129999999999997, 
    (Timestamp('2016-09-19 13:30:00'), 'Lean Hogs'): 55.649999999999999, 
    (Timestamp('2016-09-19 13:30:00'), 
    'Light Sweet Crude Oil'): 49.100000000000001, 
    (Timestamp('2016-09-19 13:30:00'), 'Live Cattle'): 97.599999999999994, 
    (Timestamp('2016-09-19 13:30:00'), 'NYMEX Copper Index'): 2.2170000000000001, 
    (Timestamp('2016-09-19 13:30:00'), 
    'NYMEX Palladium Index'): 681.79999999999995, 
    (Timestamp('2016-09-19 13:30:00'), 'NYMEX Platinum Index'): 1039.0, 
    (Timestamp('2016-09-19 13:30:00'), 
    'Soybean Meal Futures'): 337.69999999999999, 
    (Timestamp('2016-09-19 13:30:00'), 
    'Soybean Oil Futures'): 34.299999999999997, 
    (Timestamp('2016-09-19 13:30:00'), 'Wheat Futures'): 495.75, 
    (Timestamp('2016-09-19 14:00:00'), '10 Year US Treasury Note'): 128.671875, 
    (Timestamp('2016-09-19 14:00:00'), '30 Day Fed Funds'): 98.879999999999995, 
    (Timestamp('2016-09-19 14:00:00'), 
    'Bloomberg Commodity Index'): 85.099999999999994, 
    (Timestamp('2016-09-19 14:00:00'), 'E-mini S&P 500'): 2132.0, 
    (Timestamp('2016-09-19 14:00:00'), 'Gold'): 1339.3, 
    (Timestamp('2016-09-19 14:00:00'), 
    'Henry Hub Natural Gas'): 4.8380000000000001, 
    (Timestamp('2016-09-19 14:00:00'), 'Lean Hogs'): 55.774999999999999, 
    (Timestamp('2016-09-19 14:00:00'), 
    'Light Sweet Crude Oil'): 49.409999999999997, 
    (Timestamp('2016-09-19 14:00:00'), 'Live Cattle'): 97.200000000000003, 
    (Timestamp('2016-09-19 14:00:00'), 'NYMEX Copper Index'): 2.2149999999999999, 
    (Timestamp('2016-09-19 14:00:00'), 
    'NYMEX Palladium Index'): 684.35000000000002, 
    (Timestamp('2016-09-19 14:00:00'), 'NYMEX Platinum Index'): 1037.0, 
    (Timestamp('2016-09-19 14:00:00'), 
    'Soybean Meal Futures'): 336.30000000000001, 
    (Timestamp('2016-09-19 14:00:00'), 
    'Soybean Oil Futures'): 34.469999999999999, 
    (Timestamp('2016-09-19 14:00:00'), 'Wheat Futures'): 497.0, 
    (Timestamp('2016-09-19 14:30:00'), '10 Year US Treasury Note'): 128.609375, 
    (Timestamp('2016-09-19 14:30:00'), '30 Day Fed Funds'): 98.885000000000005, 
    (Timestamp('2016-09-19 14:30:00'), 
    'Bloomberg Commodity Index'): 85.099999999999994, 
    (Timestamp('2016-09-19 14:30:00'), 'E-mini S&P 500'): 2131.0, 
    (Timestamp('2016-09-19 14:30:00'), 'Gold'): 1339.0999999999999, 
    (Timestamp('2016-09-19 14:30:00'), 
    'Henry Hub Natural Gas'): 4.8179999999999996, 
    (Timestamp('2016-09-19 14:30:00'), 'Lean Hogs'): 55.174999999999997, 
    (Timestamp('2016-09-19 14:30:00'), 
    'Light Sweet Crude Oil'): 49.719999999999999, 
    (Timestamp('2016-09-19 14:30:00'), 'Live Cattle'): 97.200000000000003, 
    (Timestamp('2016-09-19 14:30:00'), 'NYMEX Copper Index'): 2.2149999999999999, 
    (Timestamp('2016-09-19 14:30:00'), 'NYMEX Palladium Index'): 691.25, 
    (Timestamp('2016-09-19 14:30:00'), 'NYMEX Platinum Index'): 1039.0, 
    (Timestamp('2016-09-19 14:30:00'), 
    'Soybean Meal Futures'): 334.89999999999998, 
    (Timestamp('2016-09-19 14:30:00'), 'Soybean Oil Futures'): 34.5, 
    (Timestamp('2016-09-19 14:30:00'), 'Wheat Futures'): 494.25, 
    (Timestamp('2016-09-19 15:00:00'), '10 Year US Treasury Note'): 128.609375, 
    (Timestamp('2016-09-19 15:00:00'), '30 Day Fed Funds'): 98.885000000000005, 
    (Timestamp('2016-09-19 15:00:00'), 
    'Bloomberg Commodity Index'): 85.099999999999994, 
    (Timestamp('2016-09-19 15:00:00'), 'E-mini S&P 500'): 2128.0, 
    (Timestamp('2016-09-19 15:00:00'), 'Gold'): 1338.2}, 
'volume': {(Timestamp('2016-09-19 13:30:00'), 
    '10 Year US Treasury Note'): 30941.0, 
    (Timestamp('2016-09-19 13:30:00'), '30 Day Fed Funds'): 251.0, 
    (Timestamp('2016-09-19 13:30:00'), 'Bloomberg Commodity Index'): 0.0, 
    (Timestamp('2016-09-19 13:30:00'), 'E-mini S&P 500'): 164450.0, 
    (Timestamp('2016-09-19 13:30:00'), 'Gold'): 6173.0, 
    (Timestamp('2016-09-19 13:30:00'), 'Henry Hub Natural Gas'): 8462.0, 
    (Timestamp('2016-09-19 13:30:00'), 'Lean Hogs'): 1489.0, 
    (Timestamp('2016-09-19 13:30:00'), 'Light Sweet Crude Oil'): 30803.0, 
    (Timestamp('2016-09-19 13:30:00'), 'Live Cattle'): 2970.0, 
    (Timestamp('2016-09-19 13:30:00'), 'NYMEX Copper Index'): 3066.0, 
    (Timestamp('2016-09-19 13:30:00'), 'NYMEX Palladium Index'): 373.0, 
    (Timestamp('2016-09-19 13:30:00'), 'NYMEX Platinum Index'): 1014.0, 
    (Timestamp('2016-09-19 13:30:00'), 'Soybean Meal Futures'): 4978.0, 
    (Timestamp('2016-09-19 13:30:00'), 'Soybean Oil Futures'): 8493.0, 
    (Timestamp('2016-09-19 13:30:00'), 'Wheat Futures'): 7462.0, 
    (Timestamp('2016-09-19 14:00:00'), '10 Year US Treasury Note'): 40382.0, 
    (Timestamp('2016-09-19 14:00:00'), '30 Day Fed Funds'): 526.0, 
    (Timestamp('2016-09-19 14:00:00'), 'Bloomberg Commodity Index'): 1250.0, 
    (Timestamp('2016-09-19 14:00:00'), 'E-mini S&P 500'): 117841.0, 
    (Timestamp('2016-09-19 14:00:00'), 'Gold'): 4891.0, 
    (Timestamp('2016-09-19 14:00:00'), 'Henry Hub Natural Gas'): 3945.0, 
    (Timestamp('2016-09-19 14:00:00'), 'Lean Hogs'): 729.0, 
    (Timestamp('2016-09-19 14:00:00'), 'Light Sweet Crude Oil'): 44921.0, 
    (Timestamp('2016-09-19 14:00:00'), 'Live Cattle'): 1380.0, 
    (Timestamp('2016-09-19 14:00:00'), 'NYMEX Copper Index'): 3076.0, 
    (Timestamp('2016-09-19 14:00:00'), 'NYMEX Palladium Index'): 1062.0, 
    (Timestamp('2016-09-19 14:00:00'), 'NYMEX Platinum Index'): 624.0, 
    (Timestamp('2016-09-19 14:00:00'), 'Soybean Meal Futures'): 3007.0, 
    (Timestamp('2016-09-19 14:00:00'), 'Soybean Oil Futures'): 6114.0, 
    (Timestamp('2016-09-19 14:00:00'), 'Wheat Futures'): 3592.0, 
    (Timestamp('2016-09-19 14:30:00'), '10 Year US Treasury Note'): 32360.0, 
    (Timestamp('2016-09-19 14:30:00'), '30 Day Fed Funds'): 0.0, 
    (Timestamp('2016-09-19 14:30:00'), 'Bloomberg Commodity Index'): 0.0, 
    (Timestamp('2016-09-19 14:30:00'), 'E-mini S&P 500'): 76527.0, 
    (Timestamp('2016-09-19 14:30:00'), 'Gold'): 3831.0, 
    (Timestamp('2016-09-19 14:30:00'), 'Henry Hub Natural Gas'): 4526.0, 
    (Timestamp('2016-09-19 14:30:00'), 'Lean Hogs'): 406.0, 
    (Timestamp('2016-09-19 14:30:00'), 'Light Sweet Crude Oil'): 27306.0, 
    (Timestamp('2016-09-19 14:30:00'), 'Live Cattle'): 735.0, 
    (Timestamp('2016-09-19 14:30:00'), 'NYMEX Copper Index'): 1394.0, 
    (Timestamp('2016-09-19 14:30:00'), 'NYMEX Palladium Index'): 235.0, 
    (Timestamp('2016-09-19 14:30:00'), 'NYMEX Platinum Index'): 419.0, 
    (Timestamp('2016-09-19 14:30:00'), 'Soybean Meal Futures'): 3348.0, 
    (Timestamp('2016-09-19 14:30:00'), 'Soybean Oil Futures'): 3559.0, 
    (Timestamp('2016-09-19 14:30:00'), 'Wheat Futures'): 4125.0, 
    (Timestamp('2016-09-19 15:00:00'), '10 Year US Treasury Note'): 23938.0, 
    (Timestamp('2016-09-19 15:00:00'), '30 Day Fed Funds'): 0.0, 
    (Timestamp('2016-09-19 15:00:00'), 'Bloomberg Commodity Index'): 30.0, 
    (Timestamp('2016-09-19 15:00:00'), 'E-mini S&P 500'): 68578.0, 
    (Timestamp('2016-09-19 15:00:00'), 'Gold'): 2537.0}} 
+0

Essayez de poster de toute façon. Ce peut être un problème de formatage simple. De toute façon, je ne veux pas créer cette image à la main désagréable. Dans le pire des cas, je modifie votre question et voir/copier vos données. Le meilleur des cas est que ça a l'air génial. Un cas intermédiaire est que quelqu'un modifie votre question et corrige le formatage pour vous. – piRSquared

+0

@piRSquared Non, je ne peux pas le poster .. Je reçois un message d'erreur de SO que le message a trop de code. –

+2

Ensuite, c'est sur vous de réduire le code pour produire un exemple minimal qui peut recréer votre problème. Vous n'avez pas à faire quoi que ce soit que je dis. Mais je serais prêt à parier que si vous faisiez cela, quelqu'un répondrait à votre question très rapidement. Quelqu'un pourrait encore. – piRSquared

Répondre

1

Vous devriez être en mesure de le faire en passant tuple de (idx[...], your_value) comme premier argument à loc.

prices.loc[(idx["2016-09-19 13:30:00":"2016-09-19 14:30:00"], xxx), :] 

Exemple:

prices.loc[(idx["2016-09-19 13:30:00":"2016-09-19 14:30:00"], 'Gold'), :] 

          ID close high  low open volume 
2016-09-19 13:30:00 Gold 33824 1339.4 1341.2 1338.7 1341.2 6173.0 
2016-09-19 14:00:00 Gold 33825 1339.1 1340.2 1338.6 1339.3 4891.0 
2016-09-19 14:30:00 Gold 33826 1338.2 1339.7 1337.6 1339.1 3831.0 
+0

Oui cela fonctionne, merci. Vraiment apprécier que vous prenez le temps de répondre. BTW est-il de toute façon cela est montré dans la documentation? –

+0

@jimbasquiat Haha vous auriez du mal à trouver cela dans les docs. L'expérimentation vraiment, c'est tout. –