<jupyter_start><jupyter_text>Series<jupyter_code>import numpy as np
import pandas as pd
help(pd.Series)
myindex = ['USA', 'CANADA', 'MEXICO']
mydata = [1776, 1867, 1821]
myseries = pd.Series(data=mydata, index=myindex)
myseries
myseries[0]
myseries['USA']
ages = {'Sam': 5, 'Frank': 10, 'Spike': 7}
pd.Series(ages)
q1 = {'Japan': 80, 'China': 450, 'India': 200, 'USA': 250}
q2 = {'Brazil': 100, 'China': 500, 'India': 210, 'USA': 260}
sales_q1 = pd.Series(q1)
sales_q2 = pd.Series(q2)
sales_q1
sales_q2
sales_q1['Japan']
sales_q1[0]
sales_q1.keys()
[1, 2] * 2
np.array([1,2]) * 2
sales_q1 * 2
sales_q1 / 2
sales_q1
sales_q2
sales_q1 + sales_q2
first_half = sales_q1.add(sales_q2, fill_value=0)
sales_q1.dtype
first_half.dtype<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17748344370860927, 'fraction_numerical': 0.09271523178807947, 'mean_word_length': 6.485148514851486, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '612589', 'license': 'MIT', 'n_tokens_mistral': 406, 'n_tokens_neox': 340, 'n_words': 76, 'path': '002_pandas_series_pract.ipynb', 'repo_name': 'solattila/ds_learn_notebooks', 'size': '755'}