python-bigquery-dataframes icon indicating copy to clipboard operation
python-bigquery-dataframes copied to clipboard

feat: support `Index.to_frame()`

Open mattyopl opened this issue 1 year ago • 0 comments

Intern Starter Task

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • [ ] Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • [ ] Ensure the tests and linter pass
  • [ ] Code coverage does not decrease (if any source code was changed)
  • [ ] Appropriate docs were updated (if necessary)

can test by checking:

import pandas as pd
idx = pd.Index(['Ant', 'Bear', 'Cow'], name='animal')
df = idx.to_frame()
print(df)
df = idx.to_frame(False)
print(df)
df = idx.to_frame(name = "food")
print(df)
df = idx.to_frame(False, name = "food")
print(df)

import bigframes.core as core
idx = core.indexes.Index(['Ant', 'Bear', 'Cow'], name='animal')
df = idx.to_frame()
print(df)
df = idx.to_frame(False)
print(df)
df = idx.to_frame(name = "food")
print(df)
df = idx.to_frame(False, name = "food")
print(df)

Fixes internal 356891401 🦕

mattyopl avatar Aug 08 '24 17:08 mattyopl