'Syntax error while running python3 manage.py runserver
Im facing the below issue on my mac when I run 'python3 manage.py runserver' command
THE HOST IS ===>SHEEKRIS-M-V6GG File "/Users/sheekris/DjangoDeveloperProject/django_api/gve-api/app/manage.py", line 16 ) from exc ^ SyntaxError: invalid syntax
Below are the python installation details
SHEEKRIS-M-V6GG:sheekris$ type -a python3
python3 is /Library/Frameworks/Python.framework/Versions/3.7/bin/python3
python3 is /usr/local/bin/python3
python3 is /usr/bin/python3
SHEEKRIS-M-V6GG: sheekris$ which python3
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3
Any help is greatly appreciated
Solution 1:[1]
Try this ; lets call your dataframe df :
df.loc[df.Year == df.Year.max()]
Solution 2:[2]
how do I automatically print the year itself where the max value is
# get year of maximum of A
column = 'A'
year = df.loc[df[column] == max(df[column]), ['Year']].values[0][0]
print(year)
Solution 3:[3]
Set Year as index and find max value for each year
df1 = df.set_index('Year').assign(Min=lambda x: x.max(axis=1),
Max=lambda x: x.min(axis=1))
print(df1)
# Output
A B C D E F Min Max
Year
2007 7632014 4643033 206207 626668 89715 18654926 18654926 89715
2008 6718487 4220161 379049 735494 58535 29677697 29677697 58535
2009 1226858 5682198 482776 1015181 138083 22712088 22712088 138083
2010 978925 2229315 565625 1260765 146791 15219378 15219378 146791
2011 1500621 2452712 675770 1325025 244073 19697549 19697549 244073
2012 308064 2346778 591180 1483543 378998 33030888 33030888 308064
2013 275019 4274425 707344 1664747 296136 17503798 17503798 275019
2014 226634 3124281 891466 1807172 443671 16023363 16023363 226634
2015 2171559 3474825 1144862 1858838 585733 16778858 16778858 585733
2016 767713 4646350 2616322 1942102 458543 13970498 13970498 458543
2017 759016 4918320 1659303 2001220 796343 9730659 9730659 759016
2018 687308 6057191 1524474 2127583 1224471 19570540 19570540 687308
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Sibtain Reza |
| Solution 2 | pwasoutside |
| Solution 3 | Corralien |
