Open SummittDweller opened 3 months ago
Hi! Thanks for reporting. I guess the problem is the outdated version of Pandas. This package requires pandas >= 2.1.1. As a workaround try to update it using:
pip install pandas --upgrade
It's actually my fault. I need to migrate to pyproject.toml
for better dependencies resolution.
Ok, I've upgraded the package to 0.2.8 and Pandas to 2.2.2 but am still hitting the same "no map attribute" error as before?
I wonder if I am doing something wrong in Pandas? I stopped using it about a year ago and switched to Polars so I'm not entirely sure my implementation is correct. I'm going to remove my code so that all I do is read my Google Sheet into Pandas, and then write it back out...no changes.
@SummittDweller Could you please share the code fragment, so I can reproduce an error and fix it?
Ok, I ran a test where I pull the GS into a dataframe then send it right back... still getting the "map" error.
Ok, I've stripped my code down to just this...
# From https://pypi.org/project/gsheet-pandas/
secret_path = Path('./secrets/').resolve( )
gsheet_pandas.setup(credentials_dir=secret_path / 'credentials.json', token_dir=secret_path / 'token.json')
df = pd.from_gsheet(sheet_id, sheet_name=sheet_name)
df.to_gsheet(sheet_id, sheet_name=sheet_name, drop_columns=False)
@SummittDweller Hi! Sorry for the late response. This is a really weird issue. Your code works fine for me and you can see that tests.py contains the same code and tests pass without errors.
I guess the problem is somehow connected with your virtual environment and not the package itself.
I keep bumping into this regardless of which connection method I use:
File "./.venv/lib/python3.11/site-packages/gsheet_pandas/adapter/connection.py", line 46, in _fix_dtypes df = df.map(lambda x: str(x) if isinstance(x, (Timestamp, datetime.datetime, datetime.date)) else x) ^^^^^^
Not sure what's up with this or how to fix it.