from sklearn.feature_extraction import DictVectorizer
import csv
from sklearn import preprocessing
from sklearn import tree
from sklearn.externals.six import StringIO
#Open CSV file 'rb' is to open a file in binary format for read-only. The file pointer will be placed at the beginning of the file
data = open(r'F:\2. Deep neural network algorithm of the basic essence\machine learning deep neural network learning foundation I 29 lessons\code and material(1)\01DTree\AllElectronics.csv','rb')
reader = csv.reader(data)
header = reader.next()
print(header)
featureList = []
lableList = []
In Python 3, the reader does not have the next() attribute. Instead, use the
header = next(reader)
from sklearn.feature_extraction import DictVectorizer
import csv
from sklearn import preprocessing
from sklearn import tree
from sklearn.externals.six import StringIO
#Open CSV file 'rb' is to open a file in binary format for read-only. The file pointer will be placed at the beginning of the file
data = open(r'F:\2. Deep neural network algorithm of the basic essence\machine learning deep neural network learning foundation I 29 lessons\code and material (1)\01DTree\AllElectronics.csv','rt')
reader = csv.reader(data)
header = next(reader)
print(header)
featureList = []
lableList = []
Similar Posts:
- Python read CSV file prompt “line contains null byte” error
- What are hyperparameters in machine learning?
- python csv error: line contains null byte [How to Solve]
- [Solved] MacOS Monterey Use bizhub C308 to Print PDF Error: offending command: binary token type 151
- tf.data.Dataset.from_tensor_slices: How to Use shuffle(), repeat(), batch()
- How to Solve ModuleNotFoundError: No module named ‘sklearn.grid_search‘
- Tensorflow gradients TypeError: Fetch argument None has invalid type
- Pycharm Error: ImportError: No module named model_selection
- Python: How to Batch Read the Form Information in Word and output them to Excel file
- jupyter notebook error: No module named ‘tensorflow’