by Suf | Dec 2, 2021 | Programming, Python, Tips
Checking if a specific file exists with Python is very useful. You may want to read data in to analyse or check if a file exists before writing data to file. There are three ways to check if a file exists using the os library: isfile(), isdir(), and exists. We will...
by Suf | Dec 1, 2021 | Data Science, Programming, Python, Tips
Table of contentsWhat is a String?What is a Substring in Python?Using split()Using [start:]Using [:end]Using [start:end:step]Using List ComprehensionCheck if Substring Exists in SubstringSimilarities Between StringsPython String ComparisonSummary What is a String? A...
by Suf | Nov 30, 2021 | Data Science, Programming, Python, Tips
If we try to concatenate an integer with a string, we will raise the error “TypeError: can only concatenate str (not “int”) to str”. This error occurs because you can only concatenate strings with other strings. In this tutorial, we will go through the...
by Suf | Nov 27, 2021 | Programming, Python, Tips
Python is a popular programming language, widely used for data science and machine learning. The language comes with a wide range of libraries and packages, which have their versions and may require a specific version of Python. This article describes how to check and...
by Suf | Nov 27, 2021 | Data Science, Programming, Python, Tips
Table of contentsWhat is Cosine Similarity?How to Calculate Cosine SimilarityCosine DistanceVisual Description of Cosine SimilarityNumerical Example of Cosine SimilarityPython Example of Cosine SimilarityDifferences Between Cosine and Jaccard SimilaritySoft Cosine...