Quick Tips
Splitting Flask Routing Functions into Different Modules
We can put group-related routing functions into separate modules to keep a big project organized and avoid having one long views.py in your project. For example, we can take the login and sign-up-related functions from views.py and move them into a module named auth.py. In auth.py, we need to register a new blueprint: In auth.py:…
Installing GeoPandas with Its Dependencies, without installing Microsoft Visual C++
The Problem If you try to install GeoPandas with pip install geopandas, you may get an error like below. Since you don’t have the dependency GDAL installed, the installer cannot find the config and exits. Then you try installing gdal with pip install gdal and you get another error saying: The Solution Christoph Gohlke from…
VSCode Tricks for Web Development
Select Everything in the Outer HTML Element There is no shortcut for this by default but we can create one with the following steps: Now you can select the contents of the outer element in the DOM with the shortcut Ctrl + Shift + A. Move the Selected Rows (or the Row of the Cursor)…
Python Shortcuts
*args and **kwargs Combine lists with zip() For Else and While Else Inline conditions Unpack a collection of items and assign them to variables Assign multiple variables in one line Initialize a collection in one line Itertools
How to Create a Table of Contents in Jupyter Notebooks
Create a markdown link as usual; but set its destination as a # sign and the id you will assign to the target text, as you would in an HTML link. Then put any HTML tag around the text where your link should go, and give it an id: So yes, you can use some…
How to Create HTML and PDF Files from Jupyter Notebooks
Converting to HTML You can convert the notebook named test.ipynb to HTML using the following command: Converting to PDF You can convert the notebook named test.ipynb to PDF using the following command: If you get an error saying “Please check that pandoc is installed”, you’ll need to install it by: Hiding the Code If you…
Data Sources for Data Science Projects
1. UC Irvine Machine Learning Repository They provide ~600 datasets for machine learning applications. 2. Airbnb They provide datasets by cities that include pricing, listing details, reviews. 3. Zillow Housing Data Zillow provides their “typical home value” measures by region and housing types. They also provide a forecast dataset.
How to Enable the Context Menu Option “Open Folder as a VSCode Project” on Windows
Problem I generally like to keep my context menu clean and don’t allow any programs to add additional items. That’s what I did while installing VSCode only to realize it would be very useful to be able to right-click on a folder and open it in VSCode from there as below. I could reinstall it…
How to Solve “File [scriptName].ps1 cannot be loaded because running scripts is disabled on this system.” Error on Windows
Open the PowerShell as an administrator and run: Source: https://stackoverflow.com/a/4038991/1937377
Running Solver Silently and Handling Its Responses with VBA
UserFinish:=True option runs solver silently. You can assign SolverSolve to a variable: Then evaluate the “answer”: Source