-1

Hi I am trying to use the bootstrap_plot() function on a data sample, but run into the following error. I have used the same data arrays to plot histograms using matplotlibs hist() function with no problem.

Traceback (most recent call last):
 File "/home/Astrophysics/BootStrapping.py", line 19, in <module>
    bootstrap_plot(C, size=17517, samples=1000, color='grey')
  File "/usr/local/lib/python2.7/dist-packages/pandas-0.8.2.dev_eec8a83-py2.7- linux-    i686.egg/pandas/tools/plotting.py", line 301, in bootstrap_plot
    data = series.values
AttributeError: 'numpy.ndarray' object has no attribute 'values'

My Code

import matplotlib.pyplot as plt
import numpy as np
import scipy
import matplotlib.mlab as mlab
import statsmodels.api as sm
import pyfits
from pandas.tools.plotting import bootstrap_plot

F = '/home/khary/Astrophysics/outfiles/outmag20_2dr_9_658.txt'
#data_cube ,header_data_cube = pyfits.getdata("/home/Astrophysics/SDSS_Counts    /count.dr72bright0.3dlz01r01c06.0.fits",1,header=True)


#load arrays with data 
data=np.loadtxt(F)
C=data[:,3]
#obs_count = data_cube.field(3)

#Bootstrap plot
bootstrap_plot(C, size=17517, samples=1000, color='grey')
plt.show()

1 Answer 1

2

Pandas bootstrap_plot expects a Series as first argument.

from pandas import Series
bootstrap_plot(Series(C), size=17517, samples=1000, color='grey')
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.