susanli2016 / Machine-Learning-with-Python

Python code for common Machine Learning Algorithms

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: object of type 'numpy.int64' has no len()

danielduckworth opened this issue · comments

I'm getting the error 'TypeError: object of type 'numpy.int64' has no len()' for the last section of code.

My data file doesn't have column headings to I used 'header=None' when reading the csv file.

My data file also uses integers as the labels rather than text.

#Load data file from from GCS %gcs read --object "gs://projectname/data/data.csv" --variable csv_as_bytes df = pd.read_csv(BytesIO(csv_as_bytes), header=None, encoding='latin-1') df.head()