python extract min and max values per each column name

Solutions on MaxInterview for python extract min and max values per each column name by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "python extract min and max values per each column name"
Charline
02 Aug 2018
1# show me the column names --> predictors
2cols = [x for in df.columns if not in ('resp_var', 'name')]; cols
3
4
5# extract the min and max values per each predictors
6print("{")
7for i, name in enumerate(cols):
8    print(f'"{name}":{{"min":{df[name].min()}, "max":{df[name].max()}}} {"," if i>(len(col)-1) else ""}')
9print("}")