BUG: AttributeError: 'float' object has no attribute 'shape'
See original GitHub issueDescribe your issue.
I tried to plot QQ plot by using stats.probplot, but raised AttributeError
.
Reproducing Code Example
stats.probplot(
df['col'],
dist="norm",
plot=pylab
)
pylab.show()
Error message
AttributeError: 'float' object has no attribute 'shape'
SciPy/NumPy/Python version information
1.7.3 1.21.6 sys.version_info(major=3, minor=7, micro=15, releaselevel=‘final’, serial=0)
Issue Analytics
- State:
- Created 10 months ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
numpy.cov() exception: 'float' object has no attribute 'shape'
The error is reproducible if the array is of dtype=object : ... AttributeError: 'float' object has no attribute 'shape'.
Read more >[BUG] 'float' object has no attribute 'shape' in Data pipelines
I think the issue here is that the shape has been set to (1,) which is why it expects a numpy array. If...
Read more >AttributeError: 'float' object has no attribute 'X' (Python)
The Python "AttributeError: 'float' object has no attribute" occurs when we try to access an attribute that doesn't exist on a floating-point ...
Read more >Python – AttributeError: 'float' object has no attribute 'shape'
I'm trying to get the solution(W2) of a equation, which include np. cov, using python sympy. Solvers, but get a AttributeError: 'float' object...
Read more >'float' object has no attribute 'shape' when using .corr-pandas
I get an error: 'float' object has no attribute 'shape'. If I import the stats library and try: corr, pval=stats.pearsonr(col1,col2).
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Almost certainly, the data type of the data in the Pandas DataFrame create by bigquery is
object
. I can recreate the problem with a numpy array with data typeobject
:Try passing
df['col'].to_numpy(dtype=float)
toprobplot
.Yess, it’s worked like a charm! Thanks!!