如何显示系列中索引的所有值?

时间:2019-07-05 11:45:22

标签: python pandas indexing

我不知道如何显示系列的所有索引。

# current settings
import pandas as pd
pd.set_option('display.max_columns', 10000)
pd.set_option('display.max_rows', 10000)

s = pd.Series(np.random.randn(199), index=['place_id', 'name', 'formatted_address', 'formatted_phone_number',
       'num_comments', 'rating', 'price', 'website', 'lng', 'lat', 'category',
       'permanently_closed', 'lunes_open', 'lunes_close_mid', 'lunes_open_mid',
       'lunes_close', 'martes_open', 'martes_close_mid', 'martes_open_mid',
       'martes_close', 'miércoles_open', 'miércoles_close_mid',
       'miércoles_open_mid', 'miércoles_close', 'jueves_open',
       'jueves_close_mid', 'jueves_open_mid', 'jueves_close', 'viernes_open',
       'viernes_close_mid', 'viernes_open_mid', 'viernes_close', 'sábado_open',
       'sábado_close_mid', 'sábado_open_mid', 'sábado_close', 'domingo_open',
       'domingo_close_mid', 'domingo_open_mid', 'domingo_close', 'Monday_00',
       'Monday_01', 'Monday_02', 'Monday_03', 'Monday_04', 'Monday_05',
       'Monday_06', 'Monday_07', 'Monday_08', 'Monday_09','Monday_10', 'Monday_11', 'Monday_12', 'Monday_13', 'Monday_14',
       'Monday_15', 'Monday_16', 'Monday_17', 'Monday_18', 'Monday_19',
       'Monday_20', 'Monday_21', 'Monday_22', 'Monday_23', 'Monday_peak',
       'Tuesday_00', 'Tuesday_01', 'Tuesday_02', 'Tuesday_03', 'Tuesday_04',
       'Tuesday_05', 'Tuesday_06', 'Tuesday_07', 'Tuesday_08', 'Tuesday_09',
       'Tuesday_10', 'Tuesday_11', 'Tuesday_12', 'Tuesday_13', 'Tuesday_14',
       'Tuesday_15', 'Tuesday_16', 'Tuesday_17', 'Tuesday_18', 'Tuesday_19',
       'Tuesday_20', 'Tuesday_21', 'Tuesday_22', 'Tuesday_23', 'Tuesday_peak',
       'Wednesday_00', 'Wednesday_01', 'Wednesday_02', 'Wednesday_03',
       'Wednesday_04', 'Wednesday_05', 'Wednesday_06', 'Wednesday_07',
       'Wednesday_08', 'Wednesday_09','Wednesday_11', 'Wednesday_12', 'Wednesday_13', 'Wednesday_14',
       'Wednesday_15', 'Wednesday_16', 'Wednesday_17', 'Wednesday_18',
       'Wednesday_19', 'Wednesday_20', 'Wednesday_21', 'Wednesday_22',
       'Wednesday_23', 'Wednesday_peak', 'Thursday_00', 'Thursday_01',
       'Thursday_02', 'Thursday_03', 'Thursday_04', 'Thursday_05',
       'Thursday_06', 'Thursday_07', 'Thursday_08', 'Thursday_09',
       'Thursday_10', 'Thursday_11', 'Thursday_12', 'Thursday_13',
       'Thursday_14', 'Thursday_15', 'Thursday_16', 'Thursday_17',
       'Thursday_18', 'Thursday_19', 'Thursday_20', 'Thursday_21',
       'Thursday_22', 'Thursday_23', 'Thursday_peak', 'Friday_00', 'Friday_01',
       'Friday_02', 'Friday_03', 'Friday_04', 'Friday_05', 'Friday_06',
       'Friday_07', 'Friday_08', 'Friday_09', 'Friday_10', 'Friday_11',
       'Friday_12', 'Friday_13', 'Friday_14', 'Friday_15', 'Friday_16',
       'Friday_17', 'Friday_18', 'Friday_19', 'Friday_20', 'Friday_21',
       'Friday_22', 'Friday_23', 'Friday_peak', 'Saturday_00', 'Saturday_01',
       'Saturday_02', 'Saturday_03', 'Saturday_04', 'Saturday_05',
       'Saturday_06', 'Saturday_07', 'Saturday_08', 'Saturday_09',
       'Saturday_10', 'Saturday_11', 'Saturday_12', 'Saturday_13',
       'Saturday_14', 'Saturday_15', 'Saturday_16', 'Saturday_17',
       'Saturday_18', 'Saturday_19', 'Saturday_20', 'Saturday_21',
       'Saturday_22', 'Saturday_23', 'Saturday_peak', 'Sunday_00', 'Sunday_01',
       'Sunday_02', 'Sunday_03', 'Sunday_04', 'Sunday_05', 'Sunday_06',
       'Sunday_07', 'Sunday_08', 'Sunday_09'])


# I ask for the index
s.index

我没有看到所有值,而是看到了

  

输出[94]:索引(['place_id','name','formatted_address',   'formatted_phone_number',          'num_comments','rating','price','website','lng','lat',          ...          'Sunday_00','Sunday_01','Sunday_02','Sunday_03','Sunday_04',          'Sunday_05','Sunday_06','Sunday_07','Sunday_08','Sunday_09'],         dtype ='object',长度= 199)

有什么想法要使用哪些设置?

2 个答案:

答案 0 :(得分:1)

您需要这个:

pd.options.display.max_seq_items = None

答案 1 :(得分:1)

s.index.values  

您可以将其存储在变量中或打印出来(这里似乎是这种情况)