Dear Barry Scott,
Thank you for your message. This code and Python instructions were conveyed by a tutorial online which is why the version seems to be used. If there is a more profound version please could you kindly suggest?
FYI, thank you for your recommendation regarding the formatting of the code for questions. I am a beginner in Python so relying on all the supportive comments from the community. FYI please see the below for more information regarding the code and thank you for your reply.
Categorical attributes visualisation
sns.countplot(df[‘Gender’])
The below refers to the traceback
ValueError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_4912\704947111.py in
1 # Exploratory Data Analysis
2 # Categorical attributes visualisation
----> 3 sns.countplot(df[‘Gender’])
c:\users\tabhr\appdata\local\programs\python\python37\lib\site-packages\seaborn\categorical.py in countplot(data, x, y, hue, order, hue_order, orient, color, palette, saturation, width, dodge, ax, **kwargs)
2945 estimator, errorbar, n_boot, units, seed,
2946 orient, color, palette, saturation,
→ 2947 width, errcolor, errwidth, capsize, dodge
2948 )
2949
c:\users\tabhr\appdata\local\programs\python\python37\lib\site-packages\seaborn\categorical.py in init(self, x, y, hue, data, order, hue_order, estimator, errorbar, n_boot, units, seed, orient, color, palette, saturation, width, errcolor, errwidth, capsize, dodge)
1529 “”“Initialize the plotter.”“”
1530 self.establish_variables(x, y, hue, data, orient,
→ 1531 order, hue_order, units)
1532 self.establish_colors(color, palette, saturation)
1533 self.estimate_statistic(estimator, errorbar, n_boot, seed)
c:\users\tabhr\appdata\local\programs\python\python37\lib\site-packages\seaborn\categorical.py in establish_variables(self, x, y, hue, data, orient, order, hue_order, units)
514
515 # Convert to a list of arrays, the common representation
→ 516 plot_data = [np.asarray(d, float) for d in plot_data]
517
518 # The group names will just be numeric indices
c:\users\tabhr\appdata\local\programs\python\python37\lib\site-packages\seaborn\categorical.py in (.0)
514
515 # Convert to a list of arrays, the common representation
→ 516 plot_data = [np.asarray(d, float) for d in plot_data]
517
518 # The group names will just be numeric indices
c:\users\tabhr\appdata\local\programs\python\python37\lib\site-packages\pandas\core\series.py in array(self, dtype)
855 dtype=‘datetime64[ns]’)
856 “”"
→ 857 return np.asarray(self._values, dtype)
858
859 # ----------------------------------------------------------------------
ValueError: could not convert string to float: ‘Male’
Please do let me know if you require any more information. Thanks