The most advanced ML Observability product in the market
Building an ML platform is nothing like putting together Ikea furniture; obviously, Ikea is way more difficult. However, they both, similarly, include many different parts that help create value when put together. As every organization sets out on a unique path to building its own machine learning platform, taking on the project of building a […]
Start integrating our products and tools.
We’re excited 😁 to share that Forbes has named Aporia a Next Billion-Dollar Company. This recognition comes on the heels of our recent $25 million Series A funding and is a huge testament that Aporia’s mission and the need for trust in AI are more relevant than ever. We are very proud to be listed […]
Consider a DataFrame with a lot of columns and we need all of them except for one. In this short how-to article, we will learn a convenient way of selecting all columns except for one.
The loc method is used for selecting rows and columns by their labels. We will write a condition in the loc method using the columns method and the name of the unwanted column.
df.loc[:, df.columns != "f3"]
We can use a list comprehension in the select function to create a list of the desired columns.
df.select([col for col in df.columns if col != "f2"])
The expression inside the select function is a list comprehension that creates a list with all the column names if it is not “f2”.
It is important to note that another way of solving this task is to drop the undesired column. Both Pandas and PySpark have a drop function to do this operation.