chris1610 / sidetable

sidetable builds simple but useful summary tables of your data
https://pbpython.com
MIT License
385 stars 29 forks source link

AttributeError: 'DataFrame' object has no attribute 'stb' #8

Closed newgithubuser2019 closed 4 years ago

newgithubuser2019 commented 4 years ago

Hi,

I get " AttributeError: 'DataFrame' object has no attribute 'stb' ".


import pandas as pd
import sidetable
df = pd.read_csv('https://github.com/chris1610/pbpython/blob/master/data/school_transform.csv?raw=True', index_col=0)
df.stb.freq(['State'])

sidetable 0.4 pandas 1.0.5

chris1610 commented 4 years ago

That is very odd. I'm not seeing it on my end. If you try sidetable.__version__ what version do you see?

newgithubuser2019 commented 4 years ago

This:

import pandas as pd
import sidetable
print(sidetable.__version__)

gives me "AttributeError: partially initialized module 'sidetable' has no attribute 'version' (most likely due to a circular import)".

Also don't know if it's important, but i was using miniconda to install sidetable.

chris1610 commented 4 years ago

It looks like something is not right with the install. I just made a couple of minor changes and released 0.5

If you wouldn't mind, can you try upgrading to this version using this command in your conda environment:

 python -m pip install -U sidetable

It's possible the conda environment got corrupter somewhere along the lines. If this doesn't work, it might be worth trying in a clean environment.

newgithubuser2019 commented 4 years ago

I've recreated my environment in conda and upgraded sidetable to 0.5. print(sidetable.__version__) still gives me "AttributeError: partially initialized module 'sidetable' has no attribute 'version' (most likely due to a circular import)".

I've also installed pandas and sidetable in default python 3.8.2 and print(sidetable.__version__) gives me the same error.

chris1610 commented 4 years ago

I'm wondering if there's something in the directory structure you are using. If you wouldn't mind, can you answer some of these questions:

One thing that can cause circular imports is if you already have a file or directory called sidetable

Is that the case by any chance?

I do apologize for the hoops. We'll figure this out.

newgithubuser2019 commented 4 years ago

Sorry for the trouble. The name of the python file was "sidetable.py".

chris1610 commented 4 years ago

No worries. I suspect this will come up again so it's good that we figured it out!