<jupyter_start><jupyter_text><jupyter_code># Questions 1: 
# How to import pandas and check the version?

import pandas as pd
print(pd.__version__)



# Questions 2: 
# How to create a series from a numpy array?

import pandas as pd 
import numpy as np 
  
# numpy array 
data = np.array(['A', 'P', 'A', 'R', 'N', 'A']) 
  
# creating series 
s = pd.Series(data) 
print(s)



# Questions 3: 
# How to convert the index of a series into a column of a dataframe?

import pandas as pd 
  
  
# Creating the dataframe df 
df = pd.DataFrame({'Roll Number': ['1', '2', '3', '4'], 
                   'Name': ['Ayesha', 'Sonali', 'Aarti', 'Snehal'], 
                   'Marks In Percentage': [97, 90, 70, 82], 
                   'Grade': ['A', 'A', 'C', 'B'], 
                   'Subject': ['Physics', 'Physics', 'Physics', 'Physics']}) 
  
# Printing the dataframe 
df



# Questions 4: 
# Write the code to list all the datasets available in seaborn library. 
# Load the mpg dataset

import seaborn as sns
tips = sns.load_dataset('tips')
tips.head()

mpg = sns.load_dataset('mpg')
mpg.head()

print(mpg)



# Questions 5: 
# Which country origin cars are a part of this dataset?


mpg = sns.load_dataset('mpg')
df = pd.DataFrame(mpg)
df.origin.unique()



# Questions 6: 
# Extract the part of the dataframe which contains cars belonging to usa

import pandas as pd 
import seaborn as sns

mpg = sns.load_dataset('mpg')
df = pd.DataFrame(mpg)
df[df['origin'].str.contains('usa')]<jupyter_output>1.1.4
0    A
1    P
2    A
3    R
4    N
5    A
dtype: object
      mpg  cylinders  ...  origin                       name
0    18.0          8  ...     usa  chevrolet chevelle malibu
1    15.0          8  ...     usa          buick skylark 320
2    18.0          8  ...     usa         plymouth satellite
3    16.0          8  ...     usa              amc rebel sst
4    17.0          8  ...     usa                ford torino
..    ...        ...  ...     ...                        ...
393  27.0          4  ...     usa            ford mustang gl
394  44.0          4  ...  europe                  vw pickup
395  32.0          4  ...     usa              dodge rampage
396  28.0          4  ...     usa                ford ranger
397  31.0          4  ...     usa                 chevy s-10

[398 rows x 9 columns]
{'fraction_non_alphanumeric': 0.11774891774891776, 'fraction_numerical': 0.04155844155844156, 'mean_word_length': 1.5995500562429696, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 9, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '270595', 'license': 'Apache-2.0', 'n_tokens_mistral': 858, 'n_tokens_neox': 765, 'n_words': 266, 'path': 'data_science_batch_1_assignment_4.ipynb', 'repo_name': 'aparna2903/letsupgreade-Python-Batch-7', 'size': '2310'}