Forum
>>
Programmazione Python
>>
Files e Directory
>>
Attribute Error: 'property' object has no attribute 'csv'
Pagina: 1
Esegui il login per scrivere una risposta.
Pagina: 1
Scritto da titurbina |
2018-01-14 14:58:11 - Attribute Error: 'property' object has no attribute 'csv'
|
Per il seguente file in Python 2.7.14 e Jupyther
import subprocess import codecs import sys reload(sys) sys.setdefaultencoding('utf-8') import os import re import time import atexit import seaborn as sns import matplotlib.pyplot as plt from pyspark import SparkConf from pyspark import SparkContext from pyspark import SQLContext import pyspark.sql.functions as F from pyspark.sql.functions import concat, col, udf, lag, date_add, explode, lit, unix_timestamp from pyspark.sql.functions import month, weekofyear, dayofmonth from pyspark.sql.types import * from pyspark.sql.types import DateType from pyspark.sql.dataframe import * from pyspark.sql.window import Window from pyspark.sql import Row from pyspark.ml.classification import * from pyspark.ml.feature import StringIndexer, OneHotEncoder, VectorAssembler, VectorIndexer from pyspark.ml.feature import StandardScaler, PCA, RFormula from pyspark.ml import Pipeline, PipelineModel start_time = time.time() from pyspark import SQLContext # Import data from Azure Blob Storage dataFile = "wasb://sampledata@pysparksampledata.blob.core.windows.net/sampledata.csv" dataFileSep = ',' df = SQLContext.read.csv(dataFile, header=True, sep=dataFileSep, inferSchema=True, nanValue="", mode='PERMISSIVE') # Import data from the home directory on your machine # dataFile = '/home/katlin/Desktop/PysparkExample/sampledata.csv' Utilizzo sia Juyiter che Pythno 2.7.14 e RIcevo il seguente messaggio di errore: --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-2-feb6a732221b> in <module>() 3 dataFile = "wasb://sampledata@pysparksampledata.blob.core.windows.net/sampledata.csv" 4 dataFileSep = ',' ----> 5 df = SQLContext.read.csv(dataFile, header=True, sep=dataFileSep, inferSchema=True, nanValue="", mode='PERMISSIVE') 6 7 # Import data from the home directory on your machine Attribute Error: 'property' object has no attribute 'csv' |
|
Scritto da Daniele aka Palmux |
2018-01-14 19:21:46 - Re: Attribute Error: 'property' object has no attribute 'csv'
|
Ciao caro, prima di qualunque cosa, per cercare un aiuto sensato, devi mettere il tuo codice in maniera leggibile.
Lo puoi fare tramite il tasto code che trovi in fase di compilazione del testo: 1. Formatta il codice; 2. Indica piattaforma su cui ti muovi; 3. Non mettere una sbrodolata di codice, ma identifica la parte che genera problemi e proponi quella. Grazie della collaborazione. |
|
Scritto da titurbina |
2018-01-14 19:41:21 - Re: Attribute Error: 'property' object has no attribute 'csv'
|
import subprocess import codecs import sys reload(sys) sys.setdefaultencoding('utf-8') import os import re import time import atexit import seaborn as sns import matplotlib.pyplot as plt from pyspark import SparkConf from pyspark import SparkContext from pyspark import SQLContext import pyspark.sql.functions as F from pyspark.sql.functions import concat, col, udf, lag, date_add, explode, lit, unix_timestamp from pyspark.sql.functions import month, weekofyear, dayofmonth from pyspark.sql.types import * from pyspark.sql.types import DateType from pyspark.sql.dataframe import * from pyspark.sql.window import Window from pyspark.sql import Row from pyspark.ml.classification import * from pyspark.ml.feature import StringIndexer, OneHotEncoder, VectorAssembler, VectorIndexer from pyspark.ml.feature import StandardScaler, PCA, RFormula from pyspark.ml import Pipeline, PipelineModel start_time = time.time() from pyspark import SQLContext # Import data from Azure Blob Storage dataFile = "wasb://sampledata@pysparksampledata.blob.core.windows.net/sampledata.csv" dataFileSep = ',' df = SQLContext.read.csv(dataFile, header=True, sep=dataFileSep, inferSchema=True, nanValue="", mode='PERMISSIVE') # Import data from the home directory on your machine # dataFile = '/home/katlin/Desktop/PysparkExample/sampledata.csv' AttributeError Traceback (most recent call last)
<ipython-input-2-feb6a732221b> in <module>() 3 dataFile = "wasb://sampledata@pysparksampledata.blob.core.windows.net/sampledata.csv" 4 dataFileSep = ',' ----> 5 df = SQLContext.read.csv(dataFile, header=True, sep=dataFileSep, inferSchema=True, nanValue="", mode='PERMISSIVE') 6 7 # Import data from the home directory on your machine AttributeError: 'property' object has no attribute 'csv' sia in Jupyter che in Pynthon mi da lo stesso erroe sopra riportatoGrazie |
Pagina: 1
Esegui il login per scrivere una risposta.