Comments (6)
Yes it looks like the facets overview code doesn't support the Categorical type. You can change it to a series of standard strings and then the proto creation should work.
In order for this code to work on Categorical series out of the box, https://github.com/PAIR-code/facets/blob/master/facets_overview/python/base_generic_feature_statistics_generator.py#L69 would need to be updated to check for the Categorical dtype and return self.fs_proto.STRING
in that case, before the current checks that use dtype.char
(since the Categorical type doesn't have the char
member variable).
from facets.
Thanks, that workaround solves things for me.
from facets.
I am running into a similar error, but here it is not handling string data.
File "/ashley/.cache/pypoetry/virtualenvs/test-BIYvDDBt-py3.8/lib/python3.8/site-packages/facets_overview/base_generic_feature_statistics_generator.py", line 54, in ProtoFromDataFrames
table_entries[col] = self.NdarrayToEntry(table[col])
File "/ashley/.cache/pypoetry/virtualenvs/test-BIYvDDBt-py3.8/lib/python3.8/site-packages/facets_overview/base_generic_feature_statistics_generator.py", line 119, in NdarrayToEntry
data_type = self.DtypeToType(x.dtype)
File "/ashley/.cache/pypoetry/virtualenvs/test-BIYvDDBt-py3.8/lib/python3.8/site-packages/facets_overview/base_generic_feature_statistics_generator.py", line 66, in DtypeToType
if dtype.char in np.typecodes['AllFloat']:
AttributeError: 'StringDtype' object has no attribute 'char'
This is using python 3.8, pandas 1.4, and facets-overview 1.0.0
Would appreciate some help!
from facets.
The facets code is quite old and doesn't contain support for the newer StringDtype for string values. If you instead use the standard "object" type for the strings, the code should work.
from facets.
@jameswex Thank you! I had to convert Int64Dtype as well it turned out. Possibly this belongs in another thread, but I am seeing a new error after doing type conversion:
proto_str = GenericFeatureStatisticsGenerator().ProtoFromDataFrames(dfs).SerializeToString()
File "/ashley/.cache/pypoetry/virtualenvs/scorecard-BIYvDDBt-py3.8/lib/python3.8/site-packages/facets_overview/base_generic_feature_statistics_generator.py", line 60, in ProtoFromDataFrames
return self.GetDatasetsProto(
File "/ashley/.cache/pypoetry/virtualenvs/scorecard-BIYvDDBt-py3.8/lib/python3.8/site-packages/facets_overview/base_generic_feature_statistics_generator.py", line 284, in GetDatasetsProto
sample_count=np.asscalar(val[0]),
File "/ashley/.cache/pypoetry/virtualenvs/scorecard-BIYvDDBt-py3.8/lib64/python3.8/site-packages/numpy/__init__.py", line 311, in __getattr__
raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'asscalar'
Any insight?
from facets.
I believe it has to do with your numpy version. See https://numpy.org/doc/1.21/reference/generated/numpy.asscalar.html
You can downgrade numpy or update the facets code to use the appropriate replacement method.
from facets.
Related Issues (20)
- Binning | X-Axis selection is not rendering correctly as a dropdown HOT 8
- HTML Imports is deprecated error still here! HOT 5
- Cannot copy text from side panel HOT 2
- Is it possible to increase the max size of the atlas?
- How to load a non local image atlas?
- Questions about Facets structure and dependencies HOT 2
- Facets buttons still too big HOT 1
- Facets as a Data Studio community report HOT 3
- Can not show column name in jupyter notebook. HOT 3
- How to save the tool outside the jupyter notebook so that the images appear on the display? HOT 4
- Custom stats cut-off with long names
- Why the facets button size is too big to see (again) HOT 2
- Support numpy >= 1.23 HOT 3
- facets dive demo no longer builds HOT 2
- Facet broken under np 1.23
- How to get started with Facets for a simple one-page website? HOT 6
- facets dive is not working in colab HOT 2
- Generate proto files to support protobuf 4.x.x and protoc 3.19.0 HOT 6
- facets_overview is failing with numpy-1.23.5 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from facets.