seaborn.countplot(*, x=None, y=None, hue=None, data=None, order=None, hue_order=None, orient=None, color=None, palette=None, saturation=0.75, dodge=True, ax=None, **kwargs)

The order argument on the sns documentation might be a little unclear. I just discovered an easier way to order your count plot to enhance your visualizations.

import pandas as pd
import numpy as np
import seaborn as sns
#Visualize the column distribution
sns.set(style='darkgrid')
sns.countplot( y= 'column', data = df, orient= 'h',
palette="Blues", order=df['column'].value_counts().index)

AttributeError: This method only works with the ScalarFormatter.

I’ve been trying to suppress this error using this line of code but the error keeps persisting:

plt.ticklabel_format(style='plain', axis='x')

Below is my entire block of code;

g = sns.catplot('balance', "acct_num", data= outliers_bal, hue='loan_classification',kind='bar', orient='h', height=6.27, col='Collateral Type',col_wrap=4,aspect=11.7/6.27, palette=sns.color_palette(['darkcyan', 'darkturquoise']))g.set_xticklabels(rotation=90)
plt.ticklabel_format(style='plain', axis='x')
plt.xlabel('Account Number')
plt.show()

The main error comes in as a result of mixing up sns and matplotlib kind of labeling.

g.set_xticklabels(rotation=90)andplt.ticklabel_format(style='plain', axis='x')

The correct way to solve this is to rotate the xticks using the matplotlib methods then also format it using matplotlib.

Try this:

plt.xticks(rotation=90)
plt.ticklabel_format(style='plain', axis='x')

Remove First and Last Character Part Two: Codewars.

This is a spin off of my first kata. You are given a list of character sequences as a comma separated string. Write a function which returns another string containing all the character sequences except the first and the last ones, separated by spaces. If the input string is empty, or the removal of the first and last items would cause the string to be empty, return a null value.

Solution:

def array(string):
separator_s = ' '
results = separator_s.join(string.split(',')[1:-1])
return results or None

Normalization — used when you want to set your values within certain limits i.e between two numbers. [0,1]

Standardization — transforms the data to have a zero mean and a standard deviation of 1.

They both make data unitless.

Why Scaling is Important.

If there’s a vast difference in the…

(Error in validateCssUnit(sizeInfo$width) : CSS units must be a single-element numeric or character vector Calls: <Anonymous> … <Anonymous> -> need_screenshot -> toHTML -> validateCssUnit Execution halted)

R Markdown Error

This error is a common occurrence if you are doing dashboards for the first time and want the dashboards in form of a html file.

Solution to this is to update your html widgets on Rstudio.

Options on doing this;

  1. install.packages(‘html widgets’)
  2. Click on the Packages on the menu bar at the right bottom side of your ide, select install, search html widgets and install.

Let it run till installation is successful then Knit your RMarkdown.

After this I’m sure you can now have your dashboards in html or can view them on a browser.

Above are the key steps in solving a time series prediction problem. To check on seasonality, trends and residuals go ahead and do decomposition to the data.

Follow up on more of my articles to see how I solved a Dengue fever prediction case in San Juan, Puerto Rico and Iquitos in Peru.

In this case I was checking if my dataset had a question mark (?) . So after dropping all the rows with the question mark I used the code below to confirm it was all removed.

exists = ‘?’ in dfprint(exists)

If the value was dropped it outputs False.

Mj Cheruiyot

Data Enthusiast/ Lover of Technology

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store