Commit d7fd8c93 by larosa

add new line

parent 82ca8e14
...@@ -15,16 +15,28 @@ title_map = { ...@@ -15,16 +15,28 @@ title_map = {
'Price Break Qty 9', 'Date Code' 'Price Break Qty 9', 'Date Code'
} }
title_arr = [
'Manufacturer Name', 'Part Number', 'Stock EMEA', 'Stock USA', 'Stock APAC', 'Stock CN', 'MOQ',
'Price Break Qty 1', 'Price Break 1', 'Price Break Qty 2', 'Price Break 2',
'Price Break Qty 3', 'Price Break 3', 'Price Break Qty 4', 'Price Break 4',
'Price Break Qty 5', 'Price Break 5', 'Price Break Qty 6', 'Price Break 6',
'Price Break Qty 7', 'Price Break 7', 'Price Break Qty 8', 'Price Break 8',
'Price Break Qty 9', 'Price Break 9'
]
class HandleCSV: class HandleCSV:
def parse(self, path): def parse(self, path):
df = pd.read_excel(path, nrows=0) df = pd.read_excel(path, nrows=0)
first_row = [] first_row = []
for i in range(len(df.columns)): for i in range(len(df.columns)):
print(df.columns[i])
first_row.append(df.columns[i]) first_row.append(df.columns[i])
if not self.validate(first_row): if not self.validate(first_row):
logger.error("文件 %s 格式错误" % path) logger.error("文件 %s 格式错误" % path)
return [] return []
print(first_row) data = pd.read_excel(path, title_arr)
print(data.values())
......
...@@ -10,7 +10,7 @@ logger = logging.getLogger('waldom_data_process_USD.py') ...@@ -10,7 +10,7 @@ logger = logging.getLogger('waldom_data_process_USD.py')
# Manufacturer ----------------> brand_name # Manufacturer ----------------> brand_name
# 库存相加 HIJK 列 # 库存相加 HIJK 列
# 加一个 multiple 列 # 加一个 multiple 列
# TODO 缺少goods_sn # TODO 缺少goods_sn 推送不要一次性推送 要一条一条推送
title_map = {'Part Number', 'Manufacturer', 'Stock EMEA', 'Stock USA', 'Stock APAC', 'Stock CN', 'MOQ', 'Multiplier', title_map = {'Part Number', 'Manufacturer', 'Stock EMEA', 'Stock USA', 'Stock APAC', 'Stock CN', 'MOQ', 'Multiplier',
'Price Break Qty 1', 'Price Break Qty 2', 'Price Break Qty 3', 'Price Break Qty 1', 'Price Break Qty 2', 'Price Break Qty 3',
...@@ -105,6 +105,7 @@ class HandleCSV: ...@@ -105,6 +105,7 @@ class HandleCSV:
if __name__ == '__main__': if __name__ == '__main__':
result = HandleCSV().parse('Tianyang_InventoryFeed.csv') result = HandleCSV().parse('Tianyang_InventoryFeed.csv')
print(result)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment