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

Versionstore: Arctic automatically assigns index a name - Perhaps needs some warning #993

Open
luongjames8 opened this issue Mar 10, 2023 · 1 comment

Comments

@luongjames8
Copy link

luongjames8 commented Mar 10, 2023

This is a bit minuitae, but a strange nit...

Arctic Version

Arctic version 1.84.4

Arctic Store

VersionStore

Platform and version

Python 3.9.7

Description of problem and/or code sample that reproduces the issue

When using the arctic package's write method, it automatically names the index "index" without informing the user. This can lead to confusion and unexpected results, particularly when reading the data back out of the library. For example:

lib = arctic.get_library(TEST_LIBRARY_NAME)

data = pd.DataFrame({"col1": [1, 2, 3], "col2": [4, 5, 6]}, 
                    index=pd.date_range('2022-01-01', periods=3, freq='D'))
lib.write(symbol="test_symbol", data=data)

return_data = lib.read(symbol="test_symbol").data

print(data.index.name, return_data.index.name)
assert return_data.index.name == data.index.name # should fail

Here, we create a Pandas DataFrame without a named index and write it to an Arctic store. We then read the data back from the store and compare the names of the original and returned indices. We expect this test to pass without any errors, but it fails due to the fact that the index is automatically named 'index' in the returned data.

To avoid confusion and prevent errors, the Arctic write method should perhapd either:

  • Inform the user that the index will be named if it is not already named, or
  • Reject writes without a named index.
@dunckerr
Copy link
Contributor

Thanks will have a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants