Skip to content

Instantly share code, notes, and snippets.

@nithyadurai87
Created June 11, 2021 11:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nithyadurai87/b0e136ad8dc13be234fb0bf43f973a70 to your computer and use it in GitHub Desktop.
Save nithyadurai87/b0e136ad8dc13be234fb0bf43f973a70 to your computer and use it in GitHub Desktop.
import pandas as pd
df = pd.read_csv("./girls.csv")
print (df.shape)
print (df.columns)
print (df['fname']) # df.fname , df['fname','age']
print (df.loc[ 1:4 , 'fname' ])
print (df.loc[ [1,4] , 'fname' ])
print (df.loc[ : , 'age']>30 )
print (df.ix[1:4, 'fname' ])
print (df.ix[[1,4], 'fname' ])
print (df.ix[ : , 'age']>30 )
print (df.iloc[1:4,1:4])
print (df.iloc[[1,4],[1,4]])
print (df.iloc[[1,4],lambda x : [1,4]])
print (pd.get_option("display.max_rows")) # max_columns
pd.set_option("display.max_rows",5) # reset_option()
pd.set_option("display.max_columns",4) # reset_option()
print (df)
pd.reset_option("display.max_rows")
pd.reset_option("display.max_columns")
print (pd.describe_option("display.max_rows"))
with pd.option_context("display.max_rows",5):
print (df)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment