Skip to content

Instantly share code, notes, and snippets.

View GeorgeSeif's full-sized avatar

George GeorgeSeif

View GitHub Profile
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
pd.merge(left=ids_and_time_df,
right=ids_and_videos_df,
on="id")
# Vertical concat
pd.concat([october_df, november_df, december_df], axis=0)
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
}
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
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
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()
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
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()
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()