<jupyter_start><jupyter_text>Functions Library  Data Science Learning  Filter a dataframe by columnname And Returns filtred dataframe<jupyter_code># Filter a dataframe by columnname And Returns filtred dataframe
def filter_dataframe(df, column_filter, columnname, columns):
    
    df_copy = df
    
    for column in columns: 
        df_copy = df_copy[df_copy[column_filter] == columnname].dropna(subset=[column])
        
    return df_copy<jupyter_output><empty_output><jupyter_text>Split column by some character value And Returns a Splitted Series<jupyter_code># Split column by some character value And Returns a Splitted Series
def split_column(df, column, splitChar):
    
    df_copy = df
    column_series = df_copy[column].apply(lambda x: x.split(splitChar))
    
    return column_series<jupyter_output><empty_output><jupyter_text>Flat a Nested List And Returns a Flat List<jupyter_code># Flat a Nested List And Returns a Flat List
def disarray(array_list):
   
    objects = []
    
    for row in array_list:
        for obj in row:
            objects.append(obj.strip())
            
    return objects<jupyter_output><empty_output><jupyter_text>Group by count to a list And Returns a Result Dictionary<jupyter_code># Group by count to a list And Returns a Result Dictionary
def group_list_PLang(data_list, year):
    
    grouped_list = dict(Counter(data_list))
    grouped_dict = [{'Programming Language':key, 'Count': value, 'Year': year} for key, value in grouped_list.items()]
    
    return grouped_dict
# Group by count to a list And Returns a Result Dictionary
def group_list_Plat(data_list, year):
    
    grouped_list = dict(Counter(data_list))
    grouped_dict = [{'Cloud Platforms':key, 'Count': value, 'Year': year} for key, value in grouped_list.items()]
    
    return grouped_dict
# Group by count to a list And Returns a Result Dictionary
def group_list_MiscTech(data_list, region):
    
    grouped_list = dict(Counter(data_list))
    grouped_dict = [{'MiscTechWantToWorkWith':key, 'Count': value, 'Region': region} for key, value in grouped_list.items()]
    
    return grouped_dict
# Group by count to a list And Returns a Result Dictionary
def group_list_NEWStuck(data_list, year):
    
    grouped_list = dict(Counter(data_list))
    grouped_dict = [{'Stucked Issues Dealing':key, 'Count': value, 'Year': year} for key, value in grouped_list.items()]
    
    return grouped_dict<jupyter_output><empty_output><jupyter_text>Create two dataframes, append them And Returns an Appended DataFrame<jupyter_code># Create two dataframes, append them And Returns an Appended DataFrame
def create_dataframe(data_dicts):
        
    df1 = pd.DataFrame(data_dicts[0])
    df2 = pd.DataFrame(data_dicts[1])

    df = pd.concat([df1,df2])
    
    return df<jupyter_output><empty_output><jupyter_text>Returns Scaled data<jupyter_code># Returns Scaled data
def percentage(df, column):
    
    df_copy = df
    series = []
    
    for val in df_copy[column].unique():
        series.append((df_copy[df_copy[column] == val]['Count'] / 
                      df_copy[df_copy[column] == val]['Count'].sum())*100)
        
    joined_series = pd.Series([],dtype=pd.StringDtype())
    for i_series in series:
        joined_series = pd.concat([joined_series,i_series])
        
    return joined_series<jupyter_output><empty_output><jupyter_text>Define Signle Color for WordCloud - It will generate WordCloud in single color<jupyter_code># Define Signle Color for WordCloud - It will generate WordCloud in single color
def one_color_func(word=None, font_size=None, 
                   position=None, orientation=None, 
                   font_path=None, random_state=None):
    h = 40 # 0 - 360
    s = 100 # 0 - 100
    l = random_state.randint(30, 70) # 0 - 100
    return "hsl({}, {}%, {}%)".format(h, s, l)<jupyter_output><empty_output><jupyter_text>Define multiple Colors for WordCloud - It will generate Multi-Color WordCloud<jupyter_code># Define multiple Colors for WordCloud - It will generate Multi-Color WordCloud
def multi_color_func(word=None, font_size=None,
                     position=None, orientation=None,
                     font_path=None, random_state=None):
    colors = [[4, 77, 82],
              [25, 74, 85],
              [82, 43, 84],
              [158, 48, 79]]
    rand = random_state.randint(0, len(colors) - 1)
    return "hsl({}, {}%, {}%)".format(colors[rand][0], colors[rand][1], colors[rand][2])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10195903829029386, 'fraction_numerical': 0.01313446126447017, 'mean_word_length': 3.744456177402323, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, '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': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '220875', 'license': 'CNRI-Python', 'n_tokens_mistral': 1475, 'n_tokens_neox': 1407, 'n_words': 387, 'path': 'FuncLib.ipynb', 'repo_name': 'vyasprateek/DataScience_NanoDegree_BlogPost', 'size': '4492'}