27 lines
732 B
Python
27 lines
732 B
Python
import pandas as pd
|
||
import logging
|
||
import json
|
||
import sys
|
||
|
||
logger = logging.getLogger('main.sub')
|
||
|
||
|
||
def read(merge):
|
||
df = pd.read_excel(merge, None)
|
||
samplelist = df['sample_info']['sampleSn'].to_list()
|
||
if not samplelist:
|
||
logger.error('sample_info表为空!读取excel信息失败!')
|
||
raise UserWarning('sample_info表为空!读取excel信息失败!')
|
||
samdict = dict()
|
||
for name, contents in df.items():
|
||
if contents.empty:
|
||
samdict[name] = []
|
||
continue
|
||
contents.fillna('.', inplace=True)
|
||
samdict[name] = contents.to_dict('list')
|
||
return samdict
|
||
|
||
|
||
if __name__ == '__main__':
|
||
res = read(sys.argv[1])
|
||
print(res) |