Category : jupyter-notebook

I am trying to create a spark dataframe from an excel file in jupyter notebook using the following code. pandasDF = pandas.read_excel(‘DownloadsData.xlsx’, sheet_name=’Sheet1′) sparkDF=spark.createDataFrame(pandasDF) sparkDF This works, and can dispay the dataframe. However if I run: sparkDF.describe().show() I get the following error: Py4JJavaError: An error occurred while calling o226.describe. : org.apache.spark.SparkException: Job aborted due to ..

Read more

Currently, I’m trying to get ratings from a website called bookstoscrape and feed it into a database as a practice but there’s an error raised InterfaceError: Error binding parameter 1 – probably unsupported type. here’s my code def getURLs(url): result = requests.get(url) soup = BeautifulSoup(result.text, ‘html.parser’) return(soup) def getBooks(url): soup = getURLs(url) # remove the ..

Read more

Is this really a syntax issue? Did I just not import the right libraries? eps_intervals = 20 max_pts = 10 num_clusters = np.zeros((eps_intervals, max_pts)) for i in range(1, eps_intervals): for j in range(max_pts): DBSCAN_model = DBSCAN(eps = i * 0.05, min_samples = j) DBSCAN_model.fit(Xs) num_clusters[i,j] = DBSCAN_model.labels_.max() + 1 receiving the error: —-> 6 for ..

Read more

i’m using jupyter and pandas to understand some patterns in a database, I have 2 date formats in the table, ‘create_time’ and ‘active_time’. If I use pf[‘create_time’] = pd.to_datetime(pf[‘create_time’],format="%d/%m/%Y") I get the following error ————————————————————————— TypeError Traceback (most recent call last) C:ProgramDataAnaconda3libsite-packagespandascoretoolsdatetimes.py in _convert_listlike_datetimes(arg, format, name, tz, unit, errors, infer_datetime_format, dayfirst, yearfirst, exact) 455 try: ..

Read more

I want to copy a specific file from different directories to another directory. Each of the directories has several files with the same extension. I want to copy one particular file from each directory to another folder and rename the file with indexes. Here is an example of my current root directory tree. root–Dir1–subDir1–subDir2 | ..

Read more