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

Feature: tp.to_numpy() #352

Open
ianspektor opened this issue Jan 17, 2024 · 9 comments
Open

Feature: tp.to_numpy() #352

ianspektor opened this issue Jan 17, 2024 · 9 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@ianspektor
Copy link
Collaborator

ianspektor commented Jan 17, 2024

Export an EventSet to numpy arrays with tp.to_numpy(evset).

See tp.to_pandas() for reference.

The EventSet is flattened (its index is dropped and kept as features, with .drop_index(keep=True)). Returns a dictionary mapping feature names to values, + an extra "timestamps" key with the timestamps.

Provide timestamps: bool = True and timestamp_to_datetime: bool = True arguments (same as in tp.to_pandas())

This needs to be tested thoroughly, see temporian/io/test/pandas_test.py for reference.

Example:

evset = tp.event_set(
    timestamps=[0, 1, 2, 3],
    features={
        "a": ["A", "B", "A", "B"],
        "b": [4, 5, 6, 7],
    },
    indexes=["a"],
)

res = tp.to_numpy(evset)
res
{
    "timestamps": [0, 1, 2, 3],
    "a": ["A", "B", "A", "B"],
    "b": [4, 6, 5, 7],
}
@ianspektor ianspektor added good first issue Good for newcomers enhancement New feature or request labels Jan 17, 2024
@Musa-Sina-Ertugrul
Copy link

Musa-Sina-Ertugrul commented Feb 11, 2024

Hi, I want to give this a try. Can you assign me? If your answer is yes, can you give some insights like where should I start to learn to succes on this issue?

penguins-of-madagascar-waving-hello-pb0tkzpn2x5dz3ho

@ianspektor
Copy link
Collaborator Author

Hey @Musa-Sina-Ertugrul! Have someone on Discord that wanted to take on it but hasn't started, just pinged them to see if they are OK with freeing it up, I'll let you know when they get back to me. Thanks!

@Musa-Sina-Ertugrul
Copy link

Not problem If he/she wants I can work on other good first issue labels.

@ianspektor
Copy link
Collaborator Author

Hey @Musa-Sina-Ertugrul! No answer from them on Discord so it's all yours if you want it.

@Musa-Sina-Ertugrul
Copy link

Thanks 😄 Yes, I want

@Musa-Sina-Ertugrul
Copy link

I could not managed preparing environment sorry :( Can you give this task to someone

@nagavenkateshgavini
Copy link
Contributor

Hello @ianspektor
I would like to contribute to this feature, please let me know If I can start working on this. Thank you.

@ianspektor
Copy link
Collaborator Author

@Musa-Sina-Ertugrul sorry to hear that - could you open an issue with what went wrong? Both so that we can help you set it up and improve the documentation for everyone else :)

@ianspektor
Copy link
Collaborator Author

@nagavenkateshgavini sure! Let me know if you run into any issues or have any doubts. I see you've joined our Discord, feel free to write there if you prefer :) Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants