add card printing data scripts
This commit is contained in:
26
scripts/card_print_data_4.py
Normal file
26
scripts/card_print_data_4.py
Normal file
@@ -0,0 +1,26 @@
|
||||
import pandas as pd
|
||||
import os
|
||||
import re
|
||||
|
||||
curdir = os.getcwd()
|
||||
path_delim = '/'
|
||||
df = pd.read_excel(curdir + path_delim + "data/12jan-printing-input.xlsx", sheet_name="Sheet1")
|
||||
|
||||
|
||||
pattern = re.compile(r'/([^/]+)\.[a-z]+$', re.IGNORECASE)
|
||||
|
||||
# Function to apply to each row of the DataFrame
|
||||
def extract_filename(file_path):
|
||||
match = pattern.search(file_path)
|
||||
return match.group(1) if match else None
|
||||
|
||||
# Apply the function to the 'file_path' column
|
||||
df['_id'] = df['Url'].apply(extract_filename)
|
||||
|
||||
print(df)
|
||||
print(df.columns)
|
||||
|
||||
writer = pd.ExcelWriter(curdir + path_delim + "data/CardPrint11.xlsx", engine='xlsxwriter')
|
||||
df.to_excel(writer, sheet_name='op', index=False)
|
||||
|
||||
writer.close()
|
||||
Reference in New Issue
Block a user