Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Some direction needed
#1
Hello,
I am new to the python world and am about to embark on my first project. What I am trying to do is essentially replicate a excel macro. I am not using a macro because I have multiple workbooks I need to manipulate. I do know I want to use Pandas to complete this task but being my first time I am a little uncertain of things. Below are the first few steps I need to replicate.

insert a blank column after column P (after the IPPER Plan Code (CBF)column).
Call the column CON/PLAN.
Populate the formula =N14&P14 into cell Q2 of the column. Drag the formula down to populate all cells in the column.
NOTE: Clear contents in #3 below. In FIN_Find_Customer_Invoices_lines_with_Worktags.xlsx, copy the the data from row 13 to bottom.
Go to the current month Custom excel, Worksheet tab. Paste in the copied data (not as values). You will over-write the tab. Make sure columns E, F, and G are formatted as dates in the updated Worksheet tab.
Close the FIN_Find_Customer_Invoices_lines_with_Worktags.xlsx.

Here is what I am starting with:

import pandas as pd
file_name = C:\Users\u678153\Desktop\FIN_Find_Customer_Invoices_lines_with_Worktags.xlsx
df = pd.read_excel(file_name) #Read Excel file as a DataFrame
I would appreciate any guidance
Reply
#2
No one?
Reply
#3
I was actually able to insert the new column using
import pandas as pd
from pandas import ExcelWriter
from pandas import ExcelFile

df = pd.read_excel('C:/Users/u678153/Desktop/FIN_-_Find_Customer_Invoices_Lines_with_Worktags.xlsx', sheet_name='Detail', skiprows=12)
df.insert(15, 'CON/PLAN', '')

df.to_csv('C:/Users/u678153/Desktop/test.csv')
Reply
#4
A bit of a challenge when we have no access to the spreadsheet, so here goes.
insert a blank column - please google "python pandas insert column" and follow instruction that appear
rename the column: How to rename

And really for the rest of it you need some pandas knowledge. I suggest putting this aside for a minute and doing one or 2 tutorials. Might start with Tutorials point Python Pandas
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Project Direction bclanton50 1 1,323 Jan-06-2022, 11:38 PM
Last Post: lucasbazan
Question How to understand the vector/direction mason321 0 1,105 Dec-14-2021, 10:57 PM
Last Post: mason321
  Pointer in the right direction? Viking 5 2,722 Apr-22-2020, 06:14 PM
Last Post: Viking
  Length and direction cosines of lines tarikrr 1 1,762 Nov-15-2019, 04:16 AM
Last Post: SheeppOSU
  Practicing using a "flag": please point in right direction magsloo 5 3,076 May-10-2019, 04:58 AM
Last Post: perfringo
  How to create a graph for direction visualization Visiting 2 2,777 Sep-22-2018, 10:49 PM
Last Post: Visiting
  Need tutorial/direction to access shared memory ridshack 2 2,973 Feb-22-2018, 11:24 PM
Last Post: ridshack

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020