Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VWAP with custom date column #710

Open
melardev opened this issue Aug 15, 2023 · 2 comments
Open

VWAP with custom date column #710

melardev opened this issue Aug 15, 2023 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested

Comments

@melardev
Copy link

Hi, pandas TA's VWAP needs the date information in the dataframe to compute the VWAP in daily intervals, so it takes it from the index, it assumes the index is of type datetime index, would not it be more convenient if we can also specify a date column to be used instead? We may have a dataframe indexed with integers, and with a column named "Date", we may use that instead to do the daily splitting.
What do you think? Any easy solution?

@twopirllc twopirllc added enhancement New feature or request help wanted Extra attention is needed question Further information is requested labels Aug 23, 2023
@twopirllc
Copy link
Owner

Hello @melardev,

would not it be more convenient if we can also specify a date column to be used instead? What do you think? Any easy solution?

Sure. I can see the reasoning behind it. I guess I incorrectly assumed that many are using the DataFrame index as the "Date".

Off the top of my head, I am not sure how easy it is to make it optional at this point.

As far as an estimated time frame of when this can be implemented is unknown. 😑 Hopefully someone has done it or is looking to submit a PR to make this an option. 😎

Kind Regards,
KJ

@luisbarrancos
Copy link
Contributor

If you don't need the index with integers, you can convert your date column to datetime and set the dataframe index to it.

# Converting date column to datetime
df['date'] = pd.to_datetime(df['date'])
# Resetting the index
df.set_index('date', inplace=True)

If you need those integers as some form of index, you could create an "ndx" column i suppose. It all depends on your application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants