Pandas-method-chaining is a plugin for flake8 that provides method chaining linting for pandas code

Overview

pandas-method-chaining

pandas-method-chaining is a plugin for flake8 that provides method chaining linting for pandas code.

It is a fork from pandas-vet. The global framework of pandas-vet has been reused. All rules have been fully rewritten and adapted to pandas method chaining, except the one dealing with the use of inplace=True.

Motivation

The source of motivation is to help pandas users to write method chaining code style.

Why a fork? The original pandas-vet includes rules which don't deal with method chaining, and some of them are not compatible with this style (e.g. PD005 and PD006 using operators instead of methods).

A source of inspiration was Matt Harrisson's book Effective Pandas.

Limits

  • False positives may occur: e.g., either non pandas statements matching the rules, or intentional style of the programmer.
  • Output messages could be improved: e.g., either too general, or not adapted to specific cases.

Installation

pandas-method-chaining is a plugin for flake8. If you don't have flake8 already, it will install automatically when you install pandas-method-chaining.

For the moment, the plugin is on github only and can be installed, in a dedicated environment, after cloning the repo by:

$ pip install -e .

When this plugin meets its users, it will be added to PyPI to ease the installation.

Usage

Once installed successfully in an environment that also has flake8 installed, pandas-method-chaining should run using:

$ flake8 python_script.py --select=PMC

Contributors

Contributors from pandas-vet

Other contributor

  • fran6w

List of warnings

Except PMC001 which uses a should, other warnings use a could.

PMC001 usage of inplace=True should be avoided

PMC002 reassignment using call could be replaced by method chaining

PMC003 reassignment using subscript could be replaced by method chaining

PMC004 assignment using subscript could be replaced by assign()

PMC005 assignment using attribute could be replaced by assign()

PMC006 assignment of index or columns could be replaced by rename()

PMC007 selection reusing a variable could be performed with a lambda

You might also like...
100 Days of Machine and Deep Learning Code

💯 Days of Machine Learning and Deep Learning Code MACHINE LEARNING TOPICS COVERED - FROM SCRATCH Linear Regression Logistic Regression K Means Cluste

Turns your machine learning code into microservices with web API, interactive GUI, and more.
Turns your machine learning code into microservices with web API, interactive GUI, and more.

Turns your machine learning code into microservices with web API, interactive GUI, and more.

This is the code repository for Interpretable Machine Learning with Python, published by Packt.
This is the code repository for Interpretable Machine Learning with Python, published by Packt.

Interpretable Machine Learning with Python, published by Packt

This is a public repo where code samples are stored for the book Practical MLOps. Traingenerator  🧙   A web app to generate template code for machine learning ✨
Traingenerator 🧙 A web app to generate template code for machine learning ✨

Traingenerator 🧙 A web app to generate template code for machine learning ✨ 🎉 Traingenerator is now live! 🎉

Contains an implementation (sklearn API) of the algorithm proposed in
Contains an implementation (sklearn API) of the algorithm proposed in "GENDIS: GEnetic DIscovery of Shapelets" and code to reproduce all experiments.

GENDIS GENetic DIscovery of Shapelets In the time series classification domain, shapelets are small subseries that are discriminative for a certain cl

Code base of KU AIRS: SPARK Autonomous Vehicle Team

KU AIRS: SPARK Autonomous Vehicle Project Check this link for the blog post describing this project and the video of SPARK in simulation and on parkou

PLUR is a collection of source code datasets suitable for graph-based machine learning.

PLUR (Programming-Language Understanding and Repair) is a collection of source code datasets suitable for graph-based machine learning. We provide scripts for downloading, processing, and loading the datasets. This is done by offering a unified API and data structures for all datasets.

This is the code repository for LRM Stochastic watershed model.

LRM-Squannacook Input data for generating stochastic streamflows are observed and simulated timeseries of streamflow. their format needs to be CSV wit

Owner
Francis
Computer & Data Scientist - Data & AI Consultant - Python and Data Science Trainer & Teacher
Francis
A Python Module That Uses ANN To Predict A Stocks Price And Also Provides Accurate Technical Analysis With Many High Potential Implementations!

Stox A Module to predict the "close price" for the next day and give "technical analysis". It uses a Neural Network and the LSTM algorithm to predict

Stox 31 Dec 16, 2022
Meerkat provides fast and flexible data structures for working with complex machine learning datasets.

Meerkat makes it easier for ML practitioners to interact with high-dimensional, multi-modal data. It provides simple abstractions for data inspection, model evaluation and model training supported by efficient and robust IO under the hood.

Robustness Gym 115 Dec 12, 2022
Falken provides developers with a service that allows them to train AI that can play their games

Falken provides developers with a service that allows them to train AI that can play their games. Unlike traditional RL frameworks that learn through rewards or batches of offline training, Falken is based on training AI via realtime, human interactions.

Google Research 223 Jan 3, 2023
This repository contains the code to predict house price using Linear Regression Method

House-Price-Prediction-Using-Linear-Regression The dataset I used for this personal project is from Kaggle uploaded by aariyan panchal. Link of Datase

null 0 Jan 28, 2022
Pandas Machine Learning and Quant Finance Library Collection

Pandas Machine Learning and Quant Finance Library Collection

null 148 Dec 7, 2022
K-means clustering is a method used for clustering analysis, especially in data mining and statistics.

K Means Algorithm What is K Means This algorithm is an iterative algorithm that partitions the dataset according to their features into K number of pr

null 1 Nov 1, 2021
inding a method to objectively quantify skill versus chance in games, using reinforcement learning

Skill-vs-chance-games-analysis - Finding a method to objectively quantify skill versus chance in games, using reinforcement learning

Marcus Chiam 4 Nov 19, 2022
Automatically build ARIMA, SARIMAX, VAR, FB Prophet and XGBoost Models on Time Series data sets with a Single Line of Code. Now updated with Dask to handle millions of rows.

Auto_TS: Auto_TimeSeries Automatically build multiple Time Series models using a Single Line of Code. Now updated with Dask. Auto_timeseries is a comp

AutoViz and Auto_ViML 519 Jan 3, 2023
Uber Open Source 1.6k Dec 31, 2022
Examples and code for the Practical Machine Learning workshop series

Practical Machine Learning Workshop Series Practical Machine Learning for Quantitative Finance Post conference workshop at the WBS Spring Conference D

CompatibL 21 Jun 25, 2022