<jupyter_start><jupyter_text>Ickle*Data Analysis Library for Python*This Jupyter Notebook serves as the documentation for Ickle.You can contribute to Ickle here: https://github.com/karishmashuklaa/ickle   Table Of Contents1. [Getting Started](Getting-Started)2. [DataFrame and Visual Representation](DataFrame-and-Visual-Representation)3. [Basic Properties](Basic-Properties)4. [Selection of Subsets](Selection-of-Subsets)5. [Basic and Aggregation Methods](Basic-And-Aggregation-Methods)6. [Non-Aggregation Methods](Non-Aggregation-Methods)7. [Other Methods](Other-Methods)8. [Arithmetic and Comparison Operators](Arithmetic-And-Comparison-Operators)9. [String-Only Methods](String-Only-Methods)10. [Pivot Table](Pivot-Table)11. [Read CSV](Read-CSV)  Getting Started  InstallationIckle can be installed via pip.`pip install ickle`  Import`import ickle as ick`  DataFrame and Visual Representation*[Go to table of contents](Table-Of-Contents)*  DataFrameA `DataFrame` holds two dimensional heterogenous data. It accepts dictionary as input, with Numpy arrays as values and strings as column names.Parameters:- `data`: A dictionary of strings mapped to Numpy arrays. The key will become the column name.<jupyter_code>import numpy as np
import ickle as ick
name = np.array(['John', 'Sam', 'Tina', 'Josh', 'Jack', 'Jill'])
place = np.array(['Kolkata', 'Mumbai', 'Delhi', 'Mumbai', 'Mumbai', 'Mumbai'])
weight = np.array([57, 70, 54, 59, 62, 70])
married = np.array([True, False, True, False, False, False])

data = {'name': name, 'place': place, 'weight': weight, 'married': married}
df = ick.DataFrame(data)<jupyter_output><empty_output><jupyter_text>Visual Representation `DataFrame` can be displayed in the following manner<jupyter_code>df<jupyter_output><empty_output><jupyter_text>We will use the above `DataFrame` throughout the notebook  Basic Properties1. [len](len)2. [columns](columns)3. [shape](shape)4. [values](values)5. [dtypes](dtypes)*[Go to table of contents](Table-Of-Contents)*  `len`returns: the number of rows in the `DataFrame`<jupyter_code>len(df)<jupyter_output><empty_output><jupyter_text>`columns`returns: list of column names<jupyter_code>df.columns<jupyter_output><empty_output><jupyter_text>Modify exisiting column names<jupyter_code>df.columns = ['NAME', 'PLACE', 'WEIGHT', 'MARRIED']
df<jupyter_output><empty_output><jupyter_text>`shape` returns: two-item tuple of number of rows and columns in the DataFrame<jupyter_code>df.shape<jupyter_output><empty_output><jupyter_text>`values`returns: a single 2D NumPy array of all the columns of data.<jupyter_code>df.values<jupyter_output><empty_output><jupyter_text>`dtypes`returns: a two-column `DataFrame` of column names in one column and their data type in the other<jupyter_code>df.dtypes<jupyter_output><empty_output><jupyter_text>Selection of Subsets1. [Select a single column](Select-a-single-column)2. [Select multiple columns](Select-multiple-columns)3. [Boolean selection](Boolean-selection)4. [Simultaneuous selection of row and column](Simultaneuous-selection-of-row-and-column)6. [Add new / Overwrite existing columns](Add-new-/-Overwrite-existing-columns)*[Go to table of contents](Table-Of-Contents)*  Select a single columnby passing the name of column as a string<jupyter_code>df['NAME']<jupyter_output><empty_output><jupyter_text>Select multiple columns by passing column names as a list of strings<jupyter_code>df[['NAME', 'PLACE']]<jupyter_output><empty_output><jupyter_text>Boolean Selection<jupyter_code>bool_sel = df['WEIGHT'] > 60

df[bool_sel]<jupyter_output><empty_output><jupyter_text>Simultaneuous selection of row and columndf[row, col]<jupyter_code>df[0,2]<jupyter_output><empty_output><jupyter_text>Select columns as strings<jupyter_code>df[0, 'WEIGHT']<jupyter_output><empty_output><jupyter_text>Select rows as slices<jupyter_code>df[:1, 'WEIGHT']<jupyter_output><empty_output><jupyter_text>Select rows as booleans and lists<jupyter_code>bool_row = df['MARRIED']
df[bool_row, 'WEIGHT']<jupyter_output><empty_output><jupyter_text>Add new / Overwrite existing columns<jupyter_code>df['AGE'] = np.array([21, 41, 22, 42, 32, 25])
df<jupyter_output><empty_output><jupyter_text>Basic And Aggregation MethodsBasic Methods:1. [head()](head)2. [tail()](tail)Aggregation Methods:1. [min()](min)2. [max()](max)3. [mean()](mean)4. [median()](median)5. [sum()](sum)6. [var()](var)7. [std()](std)8. [all()](all)9. [any()](any)10. [argmax()](argmax)11. [argmin()](argmin)*[Go to table of contents](Table-Of-Contents)*  head**head(n)**returns: the first n rows. By default n=5<jupyter_code>df.head()<jupyter_output><empty_output><jupyter_text>tail**tail(n)**return the last n rows.By default n=5<jupyter_code>df.tail()<jupyter_output><empty_output><jupyter_text>Aggregation Methods**All aggregation methods are applied only column-wise and not row-wise.**1. [min()](min)2. [max()](max)3. [median()](median)4. [mean()](mean)5. [sum()](sum)6. [var()](var)7. [std()](std)8. [all()](all)9. [any()](any)10. [argmax()](argmax)11. [argmin()](argmin)  min**min()**used to get a minimum value for each column<jupyter_code>df.min()<jupyter_output><empty_output><jupyter_text>max**max()**used to get a maximum value for each column<jupyter_code>df.max()<jupyter_output><empty_output><jupyter_text>median**median()**computes median for each numeric column<jupyter_code>df.median()<jupyter_output><empty_output><jupyter_text>mean**mean()**computes mean for each numeric column<jupyter_code>df.mean()<jupyter_output><empty_output><jupyter_text>sum**sum()**returns the sum of all values for each column<jupyter_code>df.sum()<jupyter_output><empty_output><jupyter_text>var**var()**computes variance for each numeric column<jupyter_code>df.var()<jupyter_output><empty_output><jupyter_text>std**std()**computes standard deviation for each numeric column<jupyter_code>df.std()<jupyter_output><empty_output><jupyter_text>all**all()**it tests whether all array elements along the columns evaluate to True<jupyter_code>df.all()<jupyter_output><empty_output><jupyter_text>any**any()**it tests whether any array element along the columns evaluate to True<jupyter_code>df.any()<jupyter_output><empty_output><jupyter_text>argmax**argmax()**returns the indices of the maximum values<jupyter_code>df.argmax()<jupyter_output><empty_output><jupyter_text>argmin**argmin()**returns the indices of the minimum values<jupyter_code>df.argmin()<jupyter_output><empty_output><jupyter_text>Other Methods 1. [isna()](isna)2. [count()](count)3. [unique()](unique)4. [nunique()](nunique)5. [value_counts()](value_counts)6. [rename()](rename)7. [drop()](drop)8. [diff()](diff)9. [pct_change()](pct_change)10. [sort_values()](sort_values)11. [sample()](sample)  isna**isna()**Determines whether each value in the DataFrame is missing or not<jupyter_code>df.isna()<jupyter_output><empty_output><jupyter_text>count**count()**Counts the number of non-missing values per column<jupyter_code>df.count()<jupyter_output><empty_output><jupyter_text>unique**unique()**Finds the unique values of each column<jupyter_code>dfs = df.unique()
dfs[3]<jupyter_output><empty_output><jupyter_text>nunique**nunique()**Finds the **number** of unique values in each column.Identical to `unique()`<jupyter_code>df.nunique()<jupyter_output><empty_output><jupyter_text>value_counts**value_counts(normalize=False)**Returns the frequency of each unique value for each column.Parameters`normalize`: bool            If True, returns the relative frequencies(percent)<jupyter_code>dfs = df.value_counts()
dfs[1]<jupyter_output><empty_output><jupyter_text>rename**rename(columns)**Renames columns in the DataFrameParameters        `columns`: dict    A dictionary mapping the old column name to the new column name<jupyter_code>df.rename({'WEIGHT': 'WEIGHT (kg)'})<jupyter_output><empty_output><jupyter_text>drop**drop(columns)**Drops one or more columns from a DataFrameParameters`columns`: str or list of strings<jupyter_code>df.drop('AGE')<jupyter_output><empty_output><jupyter_text>diff**diff(n=1)**Take the difference between the current value and the nth value above itParameters`n`: int<jupyter_code>df.diff(n=2)<jupyter_output><empty_output><jupyter_text>pct_change**pct_change(n=1)**Take the percentage difference between the current value and the nth value above itParameters`n`: int<jupyter_code>df.pct_change(n=1)<jupyter_output><empty_output><jupyter_text>sort_values**sort_values(by, asc=True)**Sort the DataFrame by one or more valuesParameters`by`: str or list of column names    `asc`: boolean of sorting order<jupyter_code>df.sort_values('AGE', asc=False)<jupyter_output><empty_output><jupyter_text>sample**sample(n=None, frac=None, replace=False, seed=None)**Randomly samples rows of the DataFrameParameters`n`: int    number of rows to return    `frac`: float    Proportion of the data to sample    `replace`: bool    Whether or not to sample with replacement    `seed`: int    Seed the random number generator<jupyter_code>df.sample(n=4, frac=0.5, replace=True)<jupyter_output><empty_output><jupyter_text>Non Aggregation Methods1. [abs()](abs)2. [cummin()](cummin)3. [cummax()](cummax)4. [cumsum()](cumsum)5. [clip()](clip)6. [round()](round)7. [copy()](copy)*[Go to table of contents](Table-Of-Contents)*  abs**abs()**Takes the absolute value of each value in the DataFrame<jupyter_code>df.abs()<jupyter_output><empty_output><jupyter_text>cummin**cummin()**Finds cumulative minimum by column<jupyter_code>df.cummin()<jupyter_output><empty_output><jupyter_text>cummax**cummax()**Finds cumulative maximum by column<jupyter_code>df.cummax()<jupyter_output><empty_output><jupyter_text>cumsum**cumsum()**Finds cumulative sum by column<jupyter_code>df.cumsum()<jupyter_output><empty_output><jupyter_text>clip**clip(lower=None, upper=None)**All values less than `lower` will be set to `lower`All values greater than `upper` will be set to `upper`Parameters`lower`: number or None    `upper`: number or None<jupyter_code>df.clip(lower=55, upper=60)<jupyter_output><empty_output><jupyter_text>round**round(n)**Rounds values to the nearest `n` decimals<jupyter_code>df.round(n=1)<jupyter_output><empty_output><jupyter_text>copy**copy()**Copies the DataFrame<jupyter_code>df.copy()<jupyter_output><empty_output><jupyter_text>Arithmetic And Comparison Operators 1. [Addition](Addition)2. [Subtraction](Subtraction)3. [Multiplication](Multiplication)4. [Division](Division)5. [Floor Division](Floor-Division)6. [Power](Power)7. [Greater than](Greater-than)8. [Less than](Less-than)9. [Greater than equal to](Greater-than-equal)10. [Lesser than equal to](Lesser-than-equal)11. [Not Equal](Not-Equal)12. [Equal](Equal)*Arithmetic and Comparison Operators only work with numerical columns**[Go to table of contents](Table-Of-Contents)*<jupyter_code>df_op = df['WEIGHT']
df_op<jupyter_output><empty_output><jupyter_text>Addition<jupyter_code>df_op + 2
2 + df_op<jupyter_output><empty_output><jupyter_text>Subtraction<jupyter_code>df_op - 2
2 - df_op<jupyter_output><empty_output><jupyter_text>Multiplication<jupyter_code>df_op * 2
2 * df_op<jupyter_output><empty_output><jupyter_text>Division<jupyter_code>df_op / 2
2 / df_op<jupyter_output><empty_output><jupyter_text>Floor Division<jupyter_code>df_op // 2
2 // df_op<jupyter_output><empty_output><jupyter_text>Power<jupyter_code>df_op ** 3
3 ** df_op<jupyter_output><empty_output><jupyter_text>Greater than<jupyter_code>df_op > 50<jupyter_output><empty_output><jupyter_text>Less than<jupyter_code>df_op < 55<jupyter_output><empty_output><jupyter_text>Greater than equal<jupyter_code>df_op >= 75<jupyter_output><empty_output><jupyter_text>Lesser than equal<jupyter_code>df_op <= 55<jupyter_output><empty_output><jupyter_text>Not Equal<jupyter_code>df_op != 55<jupyter_output><empty_output><jupyter_text>Equal<jupyter_code>df_op == 70<jupyter_output><empty_output><jupyter_text>String Only Methods All the strings behave in the same manner as built-in string functions in Python.These methods can be used only with `columns`1. [capitalize()](capitalize)2. [center()](center)3. [count()](count)4. [endswith()](endswith)5. [startswith()](startswith)6. [find()](find)7. [len()](len)8. [get()](get)9. [index()](index)10. [isalnum()](isalnum)11. [isalpha()](isalpha)12. [isdecimal()](isdecimal)13. [islower()](islower)14. [isnumeric()](isnumeric)15. [isspace()](isspace)16. [istitle()](istitle)17. [isupper()](isupper)18. [lstrip()](lstrip)19. [rstrip()](rstrip)20. [strip()](strip)21. [replace()](replace)22. [swapcase()](swapcase)23. [title()](title)24. [lower()](lower)25. [upper()](upper)26. [zfill()](zfill)27. [encode()](encode)*[Go to table of contents](Table-Of-Contents)*  capitalize**capitalize(col)**<jupyter_code>df.str.capitalize('NAME')<jupyter_output><empty_output><jupyter_text>center**center(col, width, fillchar=None)**<jupyter_code>df.str.center('NAME', 10, 'a')<jupyter_output><empty_output><jupyter_text>count**count(col, sub, start=None, stop=None)**<jupyter_code>df.str.count('PLACE', 'Mumbai')<jupyter_output><empty_output><jupyter_text>endswith**endswith(col, suffix, start=None, stop=None)**<jupyter_code>df.str.endswith('NAME', 'n')<jupyter_output><empty_output><jupyter_text>startswith**startswith(col, suffix, start=None, stop=None)**<jupyter_code>df.str.startswith('NAME', 'J')<jupyter_output><empty_output><jupyter_text>find**find(col, sub, start=None, stop=None)**<jupyter_code>df.str.find('NAME', 'Tina')<jupyter_output><empty_output><jupyter_text>len**len(col)**<jupyter_code>df.str.len('NAME')<jupyter_output><empty_output><jupyter_text>get**get(col, item)**<jupyter_code>df.str.get('NAME', 0)<jupyter_output><empty_output><jupyter_text>index**index(col, sub, start=None, stop=None)**<jupyter_code>df.str.index('NAME', '')<jupyter_output><empty_output><jupyter_text>isalnum**isalnum(col)**<jupyter_code>df.str.isalnum('NAME')<jupyter_output><empty_output><jupyter_text>isalpha**isalpha(col)**<jupyter_code>df.str.isalpha('NAME')<jupyter_output><empty_output><jupyter_text>isdecimal**isdecimal(col)**<jupyter_code>df.str.isdecimal('NAME')<jupyter_output><empty_output><jupyter_text>isnumeric**isnumeric(col)**<jupyter_code>df.str.isnumeric('NAME')<jupyter_output><empty_output><jupyter_text>isspace**isspace(col)**<jupyter_code>df.str.isspace('NAME')<jupyter_output><empty_output><jupyter_text>istitle**istitle(col)**<jupyter_code>df.str.istitle('NAME')<jupyter_output><empty_output><jupyter_text>isupper**isupper(col)**<jupyter_code>df.str.isupper('NAME')<jupyter_output><empty_output><jupyter_text>islower**islower(col)**<jupyter_code>df.str.islower('NAME')<jupyter_output><empty_output><jupyter_text>lstrip**lstrip(col, chars)**<jupyter_code>df.str.lstrip('NAME', 'o')<jupyter_output><empty_output><jupyter_text>rstrip**rstrip(col, chars)**<jupyter_code>df.str.rstrip('NAME', 'o')<jupyter_output><empty_output><jupyter_text>strip**strip(col, chars)**<jupyter_code>df.str.strip('NAME', 'o')<jupyter_output><empty_output><jupyter_text>replace**replace(col, old, new, count=None)**<jupyter_code>df.str.replace('NAME', 'John', 'Cena')<jupyter_output><empty_output><jupyter_text>swapcase**swapcase(col)**<jupyter_code>df.str.swapcase('NAME')<jupyter_output><empty_output><jupyter_text>title**title(col)**<jupyter_code>df.str.title('NAME')<jupyter_output><empty_output><jupyter_text>lower**lower(col)**<jupyter_code>df.str.lower('NAME')<jupyter_output><empty_output><jupyter_text>upper**upper(col)**<jupyter_code>df.str.upper('NAME')<jupyter_output><empty_output><jupyter_text>zfill**zfill(col, width)**<jupyter_code>df.str.zfill('NAME', 10)<jupyter_output><empty_output><jupyter_text>encode**encode(col, encoding='utf-8', errors='strict')**<jupyter_code>df.str.encode('NAME')<jupyter_output><empty_output><jupyter_text>Pivot TableCreates a pivot table from one or two 'grouping' columnsParameters`rows`: str of column name to group by (Optional)`columns`: str of column name to group by (Optional)`values`: str of column name to aggregate (Required)`aggfunc`: str of aggregation function*[Go to table of contents](Table-Of-Contents)*<jupyter_code>df.pivot_table(rows='NAME', columns='PLACE', values='WEIGHT', aggfunc='mean')<jupyter_output><empty_output><jupyter_text>Read CSV**read_csv(file: string of file location)***[Go to table of contents](Table-Of-Contents)*<jupyter_code>data = ick.read_csv('./dataset/employee.csv');
data.head()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1598826549321599, 'fraction_numerical': 0.012712382349346046, 'mean_word_length': 11.084933530280649, 'pattern_counts': {'":': 0, '<': 359, '<?xml version=': 0, '>': 360, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '89', 'dir': 'jupyter-structured-clean-dedup', 'id': '290426', 'license': 'MIT', 'n_tokens_mistral': 6185, 'n_tokens_neox': 5979, 'n_words': 947, 'path': 'Ickle Documentation.ipynb', 'repo_name': 'karishmashuklaa/ickle', 'size': '16362'}