This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df = df.T | |
print(df) | |
""" | |
0 1 2 3 4 5 6 7 8 9 10 11 | |
Player Superman Batman Thanos Batman Thanos Superman Batman Thanos Black Widow Batman Thanos Superman | |
Year 2000 2000 2000 2001 2001 2002 2002 2002 2003 2004 2004 2005 | |
Points 23 43 45 65 76 34 23 78 89 76 92 87 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pd.merge(left=ids_and_time_df, | |
right=ids_and_videos_df, | |
on="id") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Vertical concat | |
pd.concat([october_df, november_df, december_df], axis=0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
display_settings = { | |
'max_columns': 10, | |
'expand_frame_repr': True, # Wrap to multiple pages | |
'max_rows': 10, | |
'precision': 2, | |
'show_dimensions': True | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
parser = argparse.ArgumentParser(description='A tutorial of argparse!') | |
group = parser.add_mutually_exclusive_group(required=True) | |
group.add_argument('--a', action='store_true', help="This is the 'a' variable") | |
group.add_argument('--b', action='store_true', help="This is the 'b' variable") | |
args = parser.parse_args() | |
a = args.a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
parser = argparse.ArgumentParser(description='A tutorial of argparse!') | |
parser.add_argument("--a", action="store_true", help="This is the 'a' variable") | |
parser.add_argument("--b", action="store_const", const=10, | |
help="This is the 'b' variable") | |
args = parser.parse_args() | |
a = args.a | |
b = args.b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
parser = argparse.ArgumentParser(description='A tutorial of argparse!') | |
parser.add_argument("--a", default=1, type=int, help="This is the 'a' variable") | |
parser.add_argument("--education", | |
choices=["highschool", "college", "university", "other"], | |
required=True, type=str, help="Your name") | |
args = parser.parse_args() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
parser = argparse.ArgumentParser(description='A tutorial of argparse!') | |
parser.add_argument("--a", default=1, type=int, help="This is the 'a' variable") | |
parser.add_argument("--education", choices=["highschool", "college", "university", "other"], | |
required=True, type=str, help="Your name") | |
args = parser.parse_args() | |
ed = args.education |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
parser = argparse.ArgumentParser(description='A tutorial of argparse!') | |
parser.add_argument("--a", default=1, type=int, help="This is the 'a' variable") | |
parser.add_argument("--name", required=True, type=str, help="Your name") | |
args = parser.parse_args() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
parser = argparse.ArgumentParser(description='A tutorial of argparse!') | |
parser.add_argument("--a", default=1, type=int, help="This is the 'a' variable") | |
parser.add_argument("--name", default=None, type=str, help="Your name") | |
args = parser.parse_args() |