我有这个脚本,它读取一个csv文件,并从中提取几列,然后用这些信息写一个新文件。其中一列是url,但它们不是整个url(/test/one.aspx)。我想将https://www.example.com添加到这个column4 image_link中的每一行,这样最终结果将是一个完整的url(https://www.example.com/test/one.aspx)
以下是我的代码
import xlsxwriter
import pandas as pd
ed = pd.read_csv('/home/google_files/google_file.csv')
df = pd.DataFrame(ed[['id', 'title', 'description', 'product_type', 'link', 'image_link', 'condition', 'availability','price', 'brand', 'gtin','mpn']])
df.to_csv('/home/csv/google_files/connexity_file.csv', index=False)
toxl = pd.ExcelWriter('/home/csv/google_files/conn_file.xlsx')
df.to_excel(toxl, index = False)
toxl.save()
转载请注明出处:http://www.dlaisen.com/article/20230526/2445707.html