-2

The title does say a lot but I'm completely new to Python and Pandas as I want to know how to do this. I have a dataframe that's roughly 21,000 rows with 4 headers. I am wanting to assign a 'keyword' (or use the original header) to each column with 21,000 rows, and have the information with the relevant data inputted into an equation with other headers doing the same thing. This data will eventually be exported to ArcGIS for processing into visual markers. I've gotten as far as retrieving the information into Pandas, and now I'm stuck.

Thank you in advance.

  • 1
    Please provide a [sample dataset and your expected result](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples). Please also see [how to ask a good question](https://stackoverflow.com/help/how-to-ask). – ddejohn Feb 09 '22 at 21:12
  • Thanks for the description. We need example data to see for our eye what you are looking at, and what your expected result is from that particular example data. For example, you can inspect the outcome of `print(df.head(20))` and if you think it's sufficient to address your the concerns of your question, paste the outcome in text form in your question. `20` is the number of rows to show and you may change that. `df` is your dataframe. After having the example data, modify it manually to produce a second table which can showcase your expected output. paste here your second table in text from – Raymond Kwok Feb 09 '22 at 21:46
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Feb 20 '22 at 04:02

1 Answers1

0

I can't comment as I don't have enough rep. Have you tried df['column name']. This is how you can use a column in equations. So, without knowing what you actually need, if you want to use columns in equations, you can do something like this:

df['new column'] = 3 * df['column name']

Or if you want to multiply 2 columns:

df['c'] = df['a'] * df['b']

Or use multiply method - (check here for original post):

df[[c'] = df[['a', 'b']].multiply(df['c'], axis="index") 

Without actually seeing a df sample or seeing the intended output, I can't be sure any of these is what you're actually after

merlin
  • 33
  • 1
  • 8