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

Feature Engineer

fastai’s df_shrink: Shrink DataFrame’s Memory Usage in One Line of Code

Changing data types of DataFrame columns to smaller data types can significantly reduce the memory usage of the DataFrame.
Instead of manually choosing smaller data types, is there a way that you can automatically change data types in one line of code?
That is when the df_shrink method of fastai comes in handy. In the code above, the memory usage of the DataFrame decreases from 200 bytes to 146 bytes,
Learn more about df_shrink here.
Link to the source code.
Favorite

fastai’s df_shrink: Shrink DataFrame’s Memory Usage in One Line of Code Read More »

add_datepart: Add Relevant DateTime Features in One Line of Code

When working with time series, other features such as year, month, week, day of the week, day of the year, whether it is the end of the year or not, can be really helpful to predict future events. Is there a way that you can get all of those features in one line of code?
Fastai’s add_datepart method allows you to do exactly that. Find an example of how to use this method above.
Link to Fastai.
Favorite

add_datepart: Add Relevant DateTime Features in One Line of Code Read More »

Geopy: Extract Location Based on Python String

If you work with location data, you might want to visualize them on the map. Geopy makes it easy to locate the coordinates of addresses across the globe based on a Python string.
After defining the app name and insert location, all you need to exact information about the location is to use location.address.
To extract the latitude and longitude or the use location.latitide, location.longitude.
Above is an example. Try it with any address that you can think of. Geopy will figure it out.
Favorite

Geopy: Extract Location Based on Python String Read More »

Decompose high dimensional data into two or three dimensions

If you want to decompose high dimensional data into two or three dimensions to visualize it, what should you do? A common technique is PCA. Even though PCA is useful, I always find it complicated to create a PCA plot until I found this doc in Yellowbrick.
I really recommend using this tool if you want to visualize PCA in a few lines of code
Favorite

Decompose high dimensional data into two or three dimensions Read More »

0
    0
    Your Cart
    Your cart is empty
    Scroll to Top

    Work with Khuyen Tran

    Work with Khuyen Tran