Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Bug in python visual

I cannot plot data using python. Seems like a localisation problem, comma is used instead of full stop as a decimal separator in a matplotlib function.

 

Feedback Type:
Frown (Error)

Timestamp:
2018-08-12T13:13:51.4662827Z

Local Time:
2018-08-12T15:13:51.4662827+02:00

Session ID:
1d200296-55c3-43e4-9668-5fa830792c31

Release:
August 2018

Product Version:
2.61.5192.541 (18.08) (x64)

Error Message:
Рŷτђσñ ŝςѓϊрţ єŗŕôг.
File "PythonScriptWrapper.PY", line 6
matplotlib.pyplot.figure(figsize=(6,08333333333333,3,63888888888889))
^
SyntaxError: invalid token


OS Version:
Microsoft Windows NT 10.0.17134.0 (x64 sv-SE)

CLR Version:
4.7 or later [Release Number = 461808]

Peak Virtual Memory:
37.9 GB

Private Memory:
284 MB

Peak Working Set:
432 MB

IE Version:
11.165.17134.0

User ID:
07052a05-5aaa-46fc-8527-45318116ac05

Workbook Package Info:
1* - sv-SE, Query Groups: 0, fastCombine: Disabled, runBackgroundAnalysis: True.

Telemetry Enabled:
True

AS Live Connection:
True

Performance Trace Logs:
C:\Users\hesu\AppData\Local\Microsoft\Power BI Desktop\PerformanceTraces.zip

Enabled Preview Features:
PBI_PythonSupportEnabled

Disabled Preview Features:
PBI_shapeMapVisualEnabled
PBI_newFromWeb
PBI_SpanishLinguisticsEnabled
CustomConnectors
PBI_variationUIChange
PBI_canvasTooltips
PBI_showIncrementalRefreshPolicy
PBI_compositeModels
PBI_DB2DQ

Disabled DirectQuery Options:
PBI_DirectQuery_Unrestricted
TreatHanaAsRelationalSource

Cloud:
GlobalCloud

DPI Scale:
100%

Supported Services:
Power BI

Formulas:


section Section1;

Status: New
Comments
ronai_bertalan
Regular Visitor

Thanks for posting this! I have the same problem in two different notebooks. I live in Hungary. 

You can set the figsize in the code and it will give you a different error. Personally, I try to not waste time with experimenting and wait for a solution posted here.

Kumail
Post Prodigy

 

I was testing around this matplot lib code and found this error

 

Feedback Type:
Frown (Error)

Timestamp:
2018-08-13T13:59:33.2130350Z

Local Time:
2018-08-13T18:59:33.2130350+05:00

Session ID:
03aea190-3aea-4697-801f-c50bf42abef1

Release:
August 2018

Product Version:
2.61.5192.541 (18.08) (x64)

Error Message:
Python script error.
Traceback (most recent call last):
File "PythonScriptWrapper.PY", line 36, in <module>
plt.show(block=False)
TypeError: <lambda>() got an unexpected keyword argument 'block'


OS Version:
Microsoft Windows NT 10.0.17134.0 (x64 en-US)

CLR Version:
4.7 or later [Release Number = 461808]

Peak Virtual Memory:
38.2 GB

Private Memory:
450 MB

Peak Working Set:
576 MB

IE Version:
11.165.17134.0

User ID:
cac819f4-0175-4dab-9b9b-f34082057ccf

Workbook Package Info:
1* - en-US, Query Groups: 0, fastCombine: Enabled, runBackgroundAnalysis: True.

Telemetry Enabled:
True

Model Default Mode:
Import

Snapshot Trace Logs:
C:\Users\Raza\Microsoft\Power BI Desktop Store App\FrownSnapShot1290279189.zip

Performance Trace Logs:
C:\Users\Raza\Microsoft\Power BI Desktop Store App\PerformanceTraces.zip

Enabled Preview Features:
PBI_shapeMapVisualEnabled
PBI_newFromWeb
CustomConnectors
PBI_variationUIChange
PBI_canvasTooltips
PBI_PythonSupportEnabled
PBI_showIncrementalRefreshPolicy
PBI_compositeModels
PBI_DB2DQ

Disabled Preview Features:
PBI_SpanishLinguisticsEnabled

Disabled DirectQuery Options:
TreatHanaAsRelationalSource

Cloud:
GlobalCloud

DPI Scale:
100%

Supported Services:
Power BI

Formulas:


section Section1;

shared policies = let
Source = Csv.Document(File.Contents("File url"),[Delimiter=",", Columns=2, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type text}}),
#"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
#"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"policyId", type text}, {"policyNumber", type text}})
in
#"Changed Type1";

shared policyholders = let
Source = Csv.Document(File.Contents("File url"),[Delimiter=",", Columns=2, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type text}}),
#"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
#"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"revisionId", type text}, {"policyholderName", type text}}),
#"Sorted Rows" = Table.Sort(#"Changed Type1",{{"revisionId", Order.Ascending}}),
#"Removed Duplicates" = Table.Distinct(#"Sorted Rows")
in
#"Removed Duplicates";

shared revisions = let
Source = Csv.Document(File.Contents("File url"),[Delimiter=",", Columns=10, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"revisionDate", type datetime}, {"cancelDate", type datetime}, {"commitDate", type datetime}, {"dateArchived", type datetime}, {"createDate", type datetime}, {"revisionId", type text}, {"policyId", type text}, {"policyStatus", type text}, {"writtenPremium", Currency.Type}, {"revisionState", type text}}),
#"Sorted Rows" = Table.Sort(#"Changed Type",{{"createDate", Order.Ascending}, {"policyId", Order.Ascending}})
in
#"Sorted Rows";

shared FactTable = let
Source = Csv.Document(File.Contents("File url"),[Delimiter=",", Columns=6, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"writtenFee", Currency.Type}, {"writtenPremium", Currency.Type}})
in
#"Changed Type";

shared CleanedFees = let
Source = Csv.Document(File.Contents("file url"),[Delimiter=",", Columns=4, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"revisionId&policyTypeItemName", type text}, {"revisionId", type text}, {"policyTypeItemName", type text}, {"writtenFee", Int64.Type}})
in
#"Changed Type";

 

 

THis is the url of the code I was testing

https://matplotlib.org/gallery/specialty_plots/system_monitor.html#sphx-glr-gallery-specialty-plots-...

Kumail
Post Prodigy

Pandas visualization seems not working at all

Feedback Type:
Frown (Error)

Timestamp:
2018-08-13T14:29:05.0354775Z

Local Time:
2018-08-13T19:29:05.0354775+05:00

Session ID:
03aea190-3aea-4697-801f-c50bf42abef1

Release:
August 2018

Product Version:
2.61.5192.541 (18.08) (x64)

Error Message:
No image was created. The Python code didn't result in creation of any visuals. Make sure your Python script results in a plot to the Python default device.

OS Version:
Microsoft Windows NT 10.0.17134.0 (x64 en-US)

CLR Version:
4.7 or later [Release Number = 461808]

Peak Virtual Memory:
38.4 GB

Private Memory:
601 MB

Peak Working Set:
608 MB

IE Version:
11.165.17134.0

User ID:
cac819f4-0175-4dab-9b9b-f34082057ccf

Workbook Package Info:
1* - en-US, Query Groups: 0, fastCombine: Enabled, runBackgroundAnalysis: True.

Telemetry Enabled:
True

Model Default Mode:
Import

Snapshot Trace Logs:
C:\Users\Raza\Microsoft\Power BI Desktop Store App\FrownSnapShot2139814350.zip

Performance Trace Logs:
C:\Users\Raza\Microsoft\Power BI Desktop Store App\PerformanceTraces.zip

Enabled Preview Features:
PBI_shapeMapVisualEnabled
PBI_newFromWeb
CustomConnectors
PBI_variationUIChange
PBI_canvasTooltips
PBI_PythonSupportEnabled
PBI_showIncrementalRefreshPolicy
PBI_compositeModels
PBI_DB2DQ

Disabled Preview Features:
PBI_SpanishLinguisticsEnabled

Disabled DirectQuery Options:
TreatHanaAsRelationalSource

Cloud:
GlobalCloud

DPI Scale:
100%

Supported Services:
Power BI

Formulas:


section Section1;

shared policies = let
Source = Csv.Document(File.Contents("DataUrl"),[Delimiter=",", Columns=2, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type text}}),
#"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
#"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"policyId", type text}, {"policyNumber", type text}})
in
#"Changed Type1";

shared policyholders = let
Source = Csv.Document(File.Contents("DataUrl"),[Delimiter=",", Columns=2, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type text}}),
#"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
#"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"revisionId", type text}, {"policyholderName", type text}}),
#"Sorted Rows" = Table.Sort(#"Changed Type1",{{"revisionId", Order.Ascending}}),
#"Removed Duplicates" = Table.Distinct(#"Sorted Rows")
in
#"Removed Duplicates";

shared revisions = let
Source = Csv.Document(File.Contents("DataUrl"),[Delimiter=",", Columns=10, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"revisionDate", type datetime}, {"cancelDate", type datetime}, {"commitDate", type datetime}, {"dateArchived", type datetime}, {"createDate", type datetime}, {"revisionId", type text}, {"policyId", type text}, {"policyStatus", type text}, {"writtenPremium", Currency.Type}, {"revisionState", type text}}),
#"Sorted Rows" = Table.Sort(#"Changed Type",{{"createDate", Order.Ascending}, {"policyId", Order.Ascending}})
in
#"Sorted Rows";

shared FactTable = let
Source = Csv.Document(File.Contents("DataUrl"),[Delimiter=",", Columns=6, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"writtenFee", Currency.Type}, {"writtenPremium", Currency.Type}})
in
#"Changed Type";

shared CleanedFees = let
Source = Csv.Document(File.Contents("DataUrl"),[Delimiter=",", Columns=4, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"revisionId&policyTypeItemName", type text}, {"revisionId", type text}, {"policyTypeItemName", type text}, {"writtenFee", Int64.Type}})
in
#"Changed Type";

v-yuezhe-msft
Employee

@htp84 @Kumail,

Could you please share sample data of your table and detailed Python script so that I can test?

Regards,
Lydia

Kumail
Post Prodigy

Hi @v-yuezhe-msft

These are the sample codes I was running.

 

1-


import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
df = pd.DataFrame(np.random.randn(1000, 4), index=ts.index, columns=list('ABCD'))
df = df.cumsum()
plt.figure(); df.plot();

 

2-

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
df1= pd.DataFrame({'employee': ['Bob', 'Jake', 'Lisa', 'Sue'],
'ages': [10, 40, 58, 25], 'salary': [1000, 40000, 58000, 25000]})
plt.figure(); df1.plot.bar();

htp84
Regular Visitor

@v-yuezhe-msft

 

I cannot share my original data but I have (almost) succeded to reproduce the error using the train dataset of this kaggle competition: https://www.kaggle.com/c/house-prices-advanced-regression-techniques

I get a similar error as my original post. Below is the code I used and the error message:

 

import pandas as pd
import matplotlib.pyplot as plt
dataset.YrSold = dataset.YrSold.astype(str)
dfPerYear = dataset.groupby(by="YrSold").sum().reset_index()
dfPerYear.plot(x="YrSold", y="SalePrice", kind="line")
plt.show()
Feedback Type:
Frown (Error)

Timestamp:
2018-08-14T14:18:32.0135794Z

Local Time:
2018-08-14T16:18:32.0135794+02:00

Session ID:
f8f0d719-3bfb-431b-9739-5eb73403e26b

Release:
August 2018

Product Version:
2.61.5192.541 (18.08) (x64)

Error Message:
Рŷτђσñ ŝςѓϊрţ єŗŕôг.
Traceback (most recent call last):
  File "PythonScriptWrapper.PY", line 6, in <module>
    matplotlib.pyplot.figure(figsize=(6,75,3,63888888888889))
  File "C:\ProgramData\Miniconda3\envs\powerBi\lib\site-packages\matplotlib\pyplot.py", line 548, in figure
    **kwargs)
  File "C:\ProgramData\Miniconda3\envs\powerBi\lib\site-packages\matplotlib\backend_bases.py", line 160, in new_figure_manager
    fig = fig_cls(*args, **kwargs)
  File "C:\ProgramData\Miniconda3\envs\powerBi\lib\site-packages\matplotlib\figure.py", line 361, in __init__
    self.bbox_inches = Bbox.from_bounds(0, 0, *figsize)
TypeError: from_bounds() takes 4 positional arguments but 6 were given


OS Version:
Microsoft Windows NT 10.0.17134.0 (x64 sv-SE)

CLR Version:
4.7 or later [Release Number = 461808]

Peak Virtual Memory:
38.2 GB

Private Memory:
511 MB

Peak Working Set:
684 MB

IE Version:
11.165.17134.0

User ID:
07052a05-5aaa-46fc-8527-45318116ac05

Workbook Package Info:
1* - sv-SE, Query Groups: 0, fastCombine: Disabled, runBackgroundAnalysis: True.

Telemetry Enabled:
True

Model Default Mode:
Import

Snapshot Trace Logs:
C:\Users\hesu\AppData\Local\Microsoft\Power BI Desktop\FrownSnapShot1979732988.zip

Performance Trace Logs:
C:\Users\hesu\AppData\Local\Microsoft\Power BI Desktop\PerformanceTraces.zip

Enabled Preview Features:
PBI_PythonSupportEnabled

Disabled Preview Features:
PBI_shapeMapVisualEnabled
PBI_newFromWeb
PBI_SpanishLinguisticsEnabled
CustomConnectors
PBI_variationUIChange
PBI_canvasTooltips
PBI_showIncrementalRefreshPolicy
PBI_compositeModels
PBI_DB2DQ

Disabled DirectQuery Options:
PBI_DirectQuery_Unrestricted
TreatHanaAsRelationalSource

Cloud:
GlobalCloud

DPI Scale:
100%

Supported Services:
Power BI

Formulas:


section Section1;

shared #"train (1)" = let
    Source = Csv.Document(File.Contents("C:\Users\hesu\Downloads\train (1).csv"),[Delimiter=",", Columns=81, Encoding=1252, QuoteStyle=QuoteStyle.None]),
    #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Id", Int64.Type}, {"MSSubClass", Int64.Type}, {"MSZoning", type text}, {"LotFrontage", type text}, {"LotArea", Int64.Type}, {"Street", type text}, {"Alley", type text}, {"LotShape", type text}, {"LandContour", type text}, {"Utilities", type text}, {"LotConfig", type text}, {"LandSlope", type text}, {"Neighborhood", type text}, {"Condition1", type text}, {"Condition2", type text}, {"BldgType", type text}, {"HouseStyle", type text}, {"OverallQual", Int64.Type}, {"OverallCond", Int64.Type}, {"YearBuilt", Int64.Type}, {"YearRemodAdd", Int64.Type}, {"RoofStyle", type text}, {"RoofMatl", type text}, {"Exterior1st", type text}, {"Exterior2nd", type text}, {"MasVnrType", type text}, {"MasVnrArea", Int64.Type}, {"ExterQual", type text}, {"ExterCond", type text}, {"Foundation", type text}, {"BsmtQual", type text}, {"BsmtCond", type text}, {"BsmtExposure", type text}, {"BsmtFinType1", type text}, {"BsmtFinSF1", Int64.Type}, {"BsmtFinType2", type text}, {"BsmtFinSF2", Int64.Type}, {"BsmtUnfSF", Int64.Type}, {"TotalBsmtSF", Int64.Type}, {"Heating", type text}, {"HeatingQC", type text}, {"CentralAir", type text}, {"Electrical", type text}, {"1stFlrSF", Int64.Type}, {"2ndFlrSF", Int64.Type}, {"LowQualFinSF", Int64.Type}, {"GrLivArea", Int64.Type}, {"BsmtFullBath", Int64.Type}, {"BsmtHalfBath", Int64.Type}, {"FullBath", Int64.Type}, {"HalfBath", Int64.Type}, {"BedroomAbvGr", Int64.Type}, {"KitchenAbvGr", Int64.Type}, {"KitchenQual", type text}, {"TotRmsAbvGrd", Int64.Type}, {"Functional", type text}, {"Fireplaces", Int64.Type}, {"FireplaceQu", type text}, {"GarageType", type text}, {"GarageYrBlt", type text}, {"GarageFinish", type text}, {"GarageCars", Int64.Type}, {"GarageArea", Int64.Type}, {"GarageQual", type text}, {"GarageCond", type text}, {"PavedDrive", type text}, {"WoodDeckSF", Int64.Type}, {"OpenPorchSF", Int64.Type}, {"EnclosedPorch", Int64.Type}, {"3SsnPorch", Int64.Type}, {"ScreenPorch", Int64.Type}, {"PoolArea", Int64.Type}, {"PoolQC", type text}, {"Fence", type text}, {"MiscFeature", type text}, {"MiscVal", Int64.Type}, {"MoSold", Int64.Type}, {"YrSold", Int64.Type}, {"SaleType", type text}, {"SaleCondition", type text}, {"SalePrice", Int64.Type}})
in
    #"Changed Type";

 

tomyc
Regular Visitor

Hi,

A temporary solution to the problem is in the “Region and Language”. If you have a comma as separator, PowierBI building a script PythonScriptWrapper.PY and takes this setting to enter floating numbers to it and that is wrong. By default, I use Polish regional settings and I faced the same problem. After changing "Decimal symbol" to the dot, I was able to plot data with a Python script. Keep in mind that you have to change the decimal symbol's setting in "Customize Format" before launching PowerBI. 

Solution

 

Regards,

Tom

 

 

ronai_bertalan
Regular Visitor

There is a well-described issue about this on Stackoverflow which has a link to this page.

https://stackoverflow.com/questions/51859000/regional-settings-conflicting-with-matplotlib-for-pytho...

HadiRajani
Frequent Visitor

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
df1= pd.DataFrame({'employee': ['Bob', 'Jake', 'Lisa', 'Sue'],
'ages': [10, 40, 58, 25], 'salary': [1000, 40000, 58000, 25000]})
plt.figure()

df1.plot.bar()

 

While running this code, im getting error: 

Feedback Type:
Frown (Error)

Timestamp:
2018-08-16T15:38:58.0010865Z

Local Time:
2018-08-16T20:38:58.0010865+05:00

Session ID:
8fa5027b-ea01-4cd4-a69e-6ebc4ad2eeea

Release:
August 2018

Product Version:
2.61.5192.541 (18.08) (x64)

Error Message:
No image was created. The Python code didn't result in creation of any visuals. Make sure your Python script results in a plot to the Python default device.

OS Version:
Microsoft Windows NT 10.0.17134.0 (x64 en-US)

CLR Version:
4.7 or later [Release Number = 461808]

Peak Virtual Memory:
38.1 GB

Private Memory:
326 MB

Peak Working Set:
430 MB

IE Version:
11.165.17134.0

User ID:
abc9f1e0-fcf1-44d2-96d6-edcbaaaed432

Workbook Package Info:
1* - en-US, Query Groups: 0, fastCombine: Disabled, runBackgroundAnalysis: True.

Telemetry Enabled:
True

Model Default Mode:
Import

Snapshot Trace Logs:
C:\Users\mubee\AppData\Local\Microsoft\Power BI Desktop\FrownSnapShot1148155082.zip

Performance Trace Logs:
C:\Users\mubee\AppData\Local\Microsoft\Power BI Desktop\PerformanceTraces.zip

Enabled Preview Features:
PBI_shapeMapVisualEnabled
PBI_SpanishLinguisticsEnabled
CustomConnectors
PBI_PythonSupportEnabled
PBI_compositeModels

Disabled Preview Features:
PBI_newFromWeb
PBI_variationUIChange
PBI_canvasTooltips
PBI_showIncrementalRefreshPolicy
PBI_DB2DQ

Disabled DirectQuery Options:
TreatHanaAsRelationalSource

Cloud:
GlobalCloud

DPI Scale:
100%

Supported Services:
Power BI

Formulas:


section Section1;

shared titanic = let
Source = Csv.Document(File.Contents("C:\Users\mubee\Downloads\Webscrape\HighchartVisual\titanic.csv"),[Delimiter=",", Columns=12, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"PassengerId", Int64.Type}, {"Survived", Int64.Type}, {"Pclass", Int64.Type}, {"Name", type text}, {"Sex", type text}, {"Age", type number}, {"SibSp", Int64.Type}, {"Parch", Int64.Type}, {"Ticket", type text}, {"Fare", type number}, {"Cabin", type text}, {"Embarked", type text}})
in
#"Changed Type";

shared fees = let
Source = Csv.Document(File.Contents("C:\Users\mubee\Downloads\Webscrape\ReportingBAProject-master\data\fees.csv"),[Delimiter=",", Columns=3, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"revisionId", type text}, {"policyTypeItemName", type text}, {"writtenFee", Int64.Type}})
in
#"Changed Type";

shared policies = let
Source = Csv.Document(File.Contents("C:\Users\mubee\Downloads\Webscrape\ReportingBAProject-master\data\policies.csv"),[Delimiter=",", Columns=2, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type text}}),
#"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
#"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"policyId", type text}, {"policyNumber", type text}})
in
#"Changed Type1";

shared policyholders = let
Source = Csv.Document(File.Contents("C:\Users\mubee\Downloads\Webscrape\ReportingBAProject-master\data\policyholders.csv"),[Delimiter=",", Columns=2, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type text}}),
#"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
#"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"revisionId", type text}, {"policyholderName", type text}})
in
#"Changed Type1";

shared revisions = let
Source = Csv.Document(File.Contents("C:\Users\mubee\Downloads\Webscrape\ReportingBAProject-master\data\revisions.csv"),[Delimiter=",", Columns=10, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"revisionDate", type datetime}, {"cancelDate", type datetime}, {"commitDate", type datetime}, {"dateArchived", type datetime}, {"createDate", type datetime}, {"revisionId", type text}, {"policyId", type text}, {"policyStatus", type text}, {"writtenPremium", type number}, {"revisionState", type text}})
in
#"Changed Type";

htp84
Regular Visitor

@tomyc Thank you, it works Smiley Happy

 

@HadiRajani You have to add plt.show() in the bottom of your script. Also, the import of numpy and the use of plt.figure() is unnecassary in the example.

Below is a modified version of your code that works on my computer after I changed my regional setting using @tomyc temporary solution.

 

import pandas as pd
import matplotlib.pyplot as plt
df1 = pd.DataFrame({'employee': ['Bob', 'Jake', 'Lisa', 'Sue'],
'ages': [10, 40, 58, 25], 'salary': [1000, 40000, 58000, 25000]})
df1.plot.bar()
plt.show()