pd.set_option("display.max_columns", None)
Showing posts with label dataframe. Show all posts
Showing posts with label dataframe. Show all posts
How to view all column names in Pandas DataFrame?
It is often annoying if you want to see all columns in your Pandas DataFrame. Set the following to display all columns.
What is the difference between iloc, loc, ix for Pandas DataFrame?
locgets rows (or columns) with particular labels from the index.
# delete columns which ends with column name "Name"
df1 = df.loc[:, ~df.columns.str.endswith('Name')]
# delete columns which contain "Name" in column name
df1 = df.loc[:, ~df.columns.str.contains('Name')]
ilocgets rows (or columns) at particular positions in the index (so it only takes integers).
ixusually tries to behave likelocbut falls back to behaving likeilocif a label is not present in the index.
Subscribe to:
Posts (Atom)