乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      pandas 怎么自由移動(dòng)每列數(shù)據(jù)

       融水公子 2023-07-10 發(fā)布于福建
      表白:黑白圣堂血天使,天劍鬼刀阿修羅。 
      講解對(duì)象:
      /pandas 怎么自由移動(dòng)每列數(shù)據(jù)
      作者:融水公子 rsgz
      ===

      今天這篇文章講解的就是使用pandas模塊,將order_20230705113030875.xlsx表格中訂單子表里面的每一列數(shù)據(jù)自由移動(dòng),如果全是文本數(shù)據(jù)的情況下 想實(shí)現(xiàn)這個(gè)需求那么pandas模塊能很快地處理
      import pandas as pd
      
      # 定義表格路徑
      file_path = r"C:\Users\Administrator\Desktop\order_20230705113030875.xlsx"
      # 讀取原始表格數(shù)據(jù)
      df_original = pd.read_excel(file_path, sheet_name="order_", engine='openpyxl', index_col=False)
      
      # 創(chuàng)建新的子表單
      df_order = pd.DataFrame(columns=['新列', '大圖(只顯示一張)', '運(yùn)單號(hào)', '尺寸', '產(chǎn)品數(shù)量', '顏色', 'sku編碼', 'temp'])
      
      # 復(fù)制數(shù)據(jù)到訂單子表
      df_order['新列'] = ""  # 在這里插入空列
      df_order['大圖(只顯示一張)'] = df_original.iloc[:, 5]  # 第六列圖片復(fù)制到第二列
      df_order['運(yùn)單號(hào)'] = df_original.iloc[:, 0]  # 第一列運(yùn)單號(hào)復(fù)制到第三列
      df_order['尺寸'] = df_original.iloc[:, 1]  # 第二列產(chǎn)品規(guī)格復(fù)制到第四列,提取Size后面的字符串
      df_order['產(chǎn)品數(shù)量'] = df_original.iloc[:, 2]  # 第三列產(chǎn)品數(shù)量復(fù)制到第五列
      df_order['顏色'] = df_original.iloc[:, 1]  # 第二列產(chǎn)品規(guī)格復(fù)制到第六列,提取Color和Size之間的字符串
      df_order['sku編碼'] = df_original.iloc[:, 4]  # 第五列SKU復(fù)制到第七列
      df_order['temp'] = df_original.iloc[:, 5]  # 第六列圖片復(fù)制到第八列
      
      # 將訂單子表寫入新的Excel文件中的子表
      with pd.ExcelWriter(file_path, mode='a', engine='openpyxl') as writer:
          df_order.to_excel(writer, sheet_name='訂單', index=False)

      上面的結(jié)果可以很快的移動(dòng)表格種的每一列數(shù)據(jù)  非常的方便
      === 
      公眾號(hào):不浪仙人
      謝謝大家的支持!可以點(diǎn)擊我的頭像,進(jìn)入我的空間瀏覽更多文章呢。建議大家360doc[www.hbhlny.cn]注冊(cè)一個(gè)賬號(hào)登錄,里面真的有很多優(yōu)秀的文章,歡迎大家的到來。
      ---
      ';

        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評(píng)論

        發(fā)表

        請(qǐng)遵守用戶 評(píng)論公約

        類似文章 更多