Hi i have uploaded excel file in databricks but it shows different language.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2024 02:59 AM
Hi,
I have attach one excel file in data bricks edition but unfortunately it shows a diiferent langaue in ouput whice i wrote display(df). below im attaching the screenshot please let me now thanking you in advance.
- Labels:
-
Spark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2024 03:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2024 12:34 PM - edited 10-21-2024 12:35 PM
CSV and Excel are not the same datatype.
You can load the excel data into a pandas dataframe and then convert it to a pyspark dataframe.
first, you have to install the openpyxl library
%pip install openpyxl
Then import PySpark Pandas:
import pyspark.pandas as ps
And then read the excel-data into a df:
path = "/Volumes/demo/raw/files/FinancialsSampleData.xlsx"
# create pandas-df
pdf_sheet1 = ps.read_excel(path, sheet_name="Financials1")
#convert pandas-df to pyspark-df
df_sheet1 = pdf_sheet1.to_spark()
display(df_sheet1)
Your df should look like this:

