<jupyter_start><jupyter_text>**[Pandas Home Page](https://www.kaggle.com/learn/pandas)**---  IntroductionRun the following cell to load your data and some utility functions.<jupyter_code>from learntools.core import binder; binder.bind(globals())
from learntools.pandas.renaming_and_combining import *
print("Setup complete.")

import pandas as pd
reviews = pd.read_csv("../input/wine-reviews/winemag-data-130k-v2.csv", index_col=0)<jupyter_output>Setup complete.<jupyter_text>ExercisesView the first several lines of your data by running the cell below:<jupyter_code>reviews.head()<jupyter_output><empty_output><jupyter_text>1.`region_1` and `region_2` are pretty uninformative names for locale columns in the dataset. Create a copy of `reviews` with these columns renamed to `region` and `locale`, respectively.<jupyter_code>renamed = reviews.rename(columns={'region_1': 'region', 'region_2': 'locale'})

# check your answer
q1.check()
# q1.hint()
# q1.solution()<jupyter_output><empty_output><jupyter_text>2.Set the index name in the dataset to `wines`.<jupyter_code>reindexed = reviews.rename_axis('wines', axis='rows')

# check your answer
q2.check()
# q2.hint()
# q2.solution()<jupyter_output><empty_output><jupyter_text>3.The [Things on Reddit](https://www.kaggle.com/residentmario/things-on-reddit/data) dataset includes product links from a selection of top-ranked forums ("subreddits") on reddit.com. Run the cell below to load a dataframe of products mentioned on the */r/gaming* subreddit and another dataframe for products mentioned on the *r//movies* subreddit.<jupyter_code>gaming_products = pd.read_csv("../input/things-on-reddit/top-things/top-things/reddits/g/gaming.csv")
gaming_products['subreddit'] = "r/gaming"
movie_products = pd.read_csv("../input/things-on-reddit/top-things/top-things/reddits/m/movies.csv")
movie_products['subreddit'] = "r/movies"<jupyter_output><empty_output><jupyter_text>Create a `DataFrame` of products mentioned on *either* subreddit.<jupyter_code>combined_products = pd.concat([gaming_products, movie_products])

# check your answer
q3.check()
# q3.hint()
# q3.solution()<jupyter_output><empty_output><jupyter_text>4.The [Powerlifting Database](https://www.kaggle.com/open-powerlifting/powerlifting-database) dataset on Kaggle includes one CSV table for powerlifting meets and a separate one for powerlifting competitors. Run the cell below to load these datasets into dataframes:<jupyter_code>powerlifting_meets = pd.read_csv("../input/powerlifting-database/meets.csv")
powerlifting_competitors = pd.read_csv("../input/powerlifting-database/openpowerlifting.csv")<jupyter_output><empty_output><jupyter_text>Both tables include references to a `MeetID`, a unique key for each meet (competition) included in the database. Using this, generate a dataset combining the two tables into one.<jupyter_code>col1 = powerlifting_meets.columns.tolist()
col2 = powerlifting_competitors.columns.tolist()
[i for i in col1 if i in col2]
left = powerlifting_meets.set_index('MeetID')
right = powerlifting_competitors.set_index('MeetID')

powerlifting_combined = left.join(right)

# check your answer
q4.check()
# q4.hint()
# q4.solution()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12242348532167395, 'fraction_numerical': 0.00905683947532792, 'mean_word_length': 6.75544794188862, 'pattern_counts': {'":': 0, '<': 32, '<?xml version=': 0, '>': 32, 'https://': 3, 'lorem ipsum': 0, 'www.': 3, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '19610', 'license': 'MIT', 'n_tokens_mistral': 1096, 'n_tokens_neox': 1078, 'n_words': 244, 'path': 'pandas/exercise/renaming-and-compiling.ipynb', 'repo_name': 'hmdprs/data-scientist', 'size': '3202'}