pandas handling of integers and NaNs
pandas converts integer columns with nan values to float64 to accommodate those values. If the results of a SQL query that contains, say, min() or max() operations, and count() operations, are rea...
pandas converts integer columns with nan values to float64 to accommodate those values. If the results of a SQL query that contains, say, min() or max() operations, and count() operations, are rea...
Updating virtual environment settings when folder names change In env\pyvenv.cfg, update file paths. In env\Scripts\activate, update file paths. Ref. \
Two-factor fixed effects regressions These can be useful to start to dig more into causality by focusing on changes in the independent and dependent variables - as this should strip out the effect ...
NB: These all require Git to be installed. Repos that have been turned into Python packages I.e. that have a setup.py file. pip install git+https://github.com/philipnye/<package_name> Repo...
Debugging Azure App Service issues Conflict (CODE: 409) When deploying an app to Azure App Service using GitHub Actions, it is possible to encounter the error message Deployment Failed, Error: Fail...
Using Django Create a project: django-admin startproject myproject cd myproject python manage.py startapp myapp Run development server: cd myproject python manage.py runserver
Calculating p-values Use an independent t-test where x and y are the same measures but the subjects are different. Use a paired t-test where x and y are the same measures and the subjects are the ...
Installing pipenv pip install pipenv Ref. Creating a virtual environment Using the current Python version: pipenv install --dev Using a specific Python version: pipenv install --python "C:\Pro...
When running scripts, PYTHONPATH is set to the parent directory of the executed script. Import statements that include the full path from the project root (absolute imports - e.g. import mypackage...
Magic commands are flagged as errors in VSCode by Pylance as they are not Python. Setting "jupyter.interactiveWindow.textEditor.magicCommandsAsComments": true and prefacing commands with # ! means...