Tuesday, July 18, 2023

How to downgrade the installed version of 'pip' on windows?

If you want to upgrade or downgrade to different version of pip, you can do it in multiple ways.

To go back to particular version, use below command

python -m pip install pip==23.1.2

If you want to upgrade or downgrade using single command, use below command with specific version

python -m pip install --upgrade pip==23.1.2

If you want to upgrade to latest version, use below command

python -m pip install --upgrade pip

Hope this helps!!

Thursday, July 13, 2023

How to read JSON list from JavaScript

To read a list of JSON objects in JavaScript, you can use the JSON.parse() function to parse the JSON string into a JavaScript object or an array.

Here's an example:

var jsonString = '[{"name":"Maximus","age":30},{"name":"Peter Parker","age":25},{"name":"Bob Krammer","age":40}]';

// Parse the JSON string into an array of objects
var jsonArray = JSON.parse(jsonString);

// Iterate over the array and access the properties of each object
for (var i = 0; i < jsonArray.length; i++) {
  var obj = jsonArray[i];
  console.log("Name: " + obj.name + ", Age: " + obj.age);
}
  

In the above example, the jsonString variable holds a JSON string representing an array of objects. The JSON.parse() function is used to parse the JSON string into the jsonArray variable, which becomes an array of objects.

You can then iterate over this array and access the properties of each object as shown in the for loop.

Note that the JSON string should be well-formed, with double quotes around property names and string values.

Hope this helps!

Friday, June 30, 2023

Best YouTube channels for Data Science

❯ Python ➟ Corey Schafer

❯ SQL ➟ Joey Blue

❯ Data Analyst ➟ AlexTheAnalyst

❯ Tableau ➟ Tableau Tim

❯ PowerBI ➟ Guy in a Cube

❯ MS Excel ➟ ExcelIsFun

❯ Machine Learning ➟ sentdex

❯ Mathematics ➟ 3Blue1Brown

❯ And the winner is  ➟ Socratica, who does educational vidoes on math, science and computers

Tuesday, June 27, 2023

Git Cheat Sheet: Essential Commands for Version Control Mastery

Git is a powerful and widely used version control system that enables developers to efficiently manage their codebase and collaborate on projects. However, mastering Git can be a daunting task, especially for beginners. To ease your learning curve, we've prepared a comprehensive Git cheat sheet that includes the most essential commands you'll need to navigate through Git's functionalities. Whether you're a novice or an experienced developer, this cheat sheet will serve as a handy reference to help you streamline your version control workflow.

Git Configuration:

  • git config --global user.name "[name]": Set your username for Git.
  • git config --global user.email "[email address]" : Set your email address for Git.
  • git config --global color.ui auto: Enable colorful output in Git.

Repository Creation and Cloning:

  • git init: Create a new Git repository in the current directory.
  • git clone [repository URL]: Clone an existing repository to your local machine.

Basic Workflow:

  • git add [file]: Add a file to the staging area.
  • git commit -m "[commit message]": Commit your changes with a descriptive message.
  • git status: Check the status of your repository.
  • git log: View the commit history.
  • git diff: Show the differences between your working directory and the last commit.

Branching and Merging:

  • git branch: List all branches in the repository.
  • git branch [branch name]: Create a new branch.
  • git checkout [branch name]: Switch to a different branch.
  • git merge [branch name]: Merge a branch into the current branch.
  • git stash: Temporarily save changes that you don't want to commit yet.

Remote Repositories:

  • git remote add [remote name] [remote URL]: Add a remote repository.
  • git push [remote name] [branch name]: Push your local changes to a remote repository.
  • git pull [remote name] [branch name]: Fetch changes from a remote repository and merge them into your local branch.

Collaboration:

  • git branch -r: List remote branches.
  • git fetch: Download objects and refs from a remote repository.
  • git branch -d [branch name]: Delete a branch.
  • git clone --branch [branch name] [repository URL]: Clone a specific branch of a repository.

Undoing Changes:

  • git reset [commit]: Un stage commits, preserving changes.
  • git revert [commit]: Create a new commit that undoes changes from a previous commit.
  • git checkout -- [file]: Discard changes in a specific file.

This Git cheat sheet provides you with a quick reference to the most commonly used commands for version control. By familiarizing yourself with these commands, you'll be able to navigate Git's functionalities with ease, collaborate effectively, and maintain a clean and organized codebase. Remember, practice makes perfect, so don't hesitate to experiment and explore additional features and options available in Git. Happy coding!

Please consider this cheat sheet as a starting point for your Git journey, and continue to expand your knowledge by exploring additional resources and documentation.