Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Filter by Categories
About Article
Analyze Data
Archive
Best Practices
Better Outputs
Blog
Code Optimization
Code Quality
Command Line
Daily tips
Dashboard
Data Analysis & Manipulation
Data Engineer
Data Visualization
DataFrame
Delta Lake
DevOps
DuckDB
Environment Management
Feature Engineer
Git
Jupyter Notebook
LLM
LLM
Machine Learning
Machine Learning
Machine Learning & AI
Manage Data
MLOps
Natural Language Processing
NumPy
Pandas
Polars
PySpark
Python Tips
Python Utilities
Python Utilities
Scrape Data
SQL
Testing
Time Series
Tools
Visualization
Visualization & Reporting
Workflow & Automation
Workflow Automation

Navigating and Managing Files in Notebooks: Top Magic Commands

Table of Contents

Navigating and Managing Files in Notebooks: Top Magic Commands

To efficiently manage folders, navigate directories, write to files, and execute scripts directly from your notebook, consider using these four highly effective magic commands that simplify these tasks:

✨ %mkdir: Create new folders.
✨ %cd: Navigate through directories.
✨ %%writefile: Write content to files.
✨ %run: Run external Python scripts.

%mkdir my_project
. --> current directory
└── my_project
%cd my_project
. 
└── my_project --> current directory
%%writefile process_data.py
print("Processing data...")
Writing process_data.py
%run process_data.py
Processing data...

 Run in Google Colab.

Leave a Comment

Your email address will not be published. Required fields are marked *

0
    0
    Your Cart
    Your cart is empty
    Scroll to Top

    Work with Khuyen Tran

    Work with Khuyen Tran