pandas如何在输入内容的情况下获取全部数组?
import pandas as pd## 用户ID等级 其他内容
##0 151248701939 1 NaN
##1 151248702303 1 30.0
##2 151248701939 1 NaN
##3 151248700919 20 NaN
##4 151248701939 3 NaN
##5 151248702325 1 30.0
##6 151248701939 103 NaN
##7 151248702152 18 NaN
##8 151248702152 19 NaN
##9 151248702152 119 NaN
##10151248702293 3 32.0
##11151248702152 2 NaN
##12151248702152 35 NaN
##13151248701388 7 NaN
##14151248701388 20 NaN
##15151248701388 20 NaN
##16151248702287 118 NaN
##17151248701569 118 2.0
df1 = pd.read_excel('J:/Users/Administrator/Desktop/test.xlsx', 'Sheet1')
ask_for_show = input('需要显示的字段(可输入多个,以分号分隔,不填写显示全部):')
if ask_for_show == '':
show_key = None #这里该输入什么让运行时内容不会报错?
else:
show_key = ask_for_show.split(';')
Output_excel = df1.loc[:,show_key] import pandas as pd
df1 = pd.read_excel('J:/Users/Administrator/Desktop/test.xlsx', 'Sheet1')
ask_for_show = input('需要显示的字段(可输入多个,以分号分隔,不填写显示全部):')
if ask_for_show == '':
Output_excel = df1.loc[:]
else:
show_key =
Output_excel = df1.loc
页:
[1]