'Am I able to assign keywords to a dataset header retrieved through Pandas and input the information under the header into eg an equation?
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.
Solution 1:[1]
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | merlin |
