<jupyter_start><jupyter_text>Creating DataFrames Good ol PYTHONPATH fix, details [here](https://stackoverflow.com/questions/16114391/adding-directory-to-sys-path-pythonpath)<jupyter_code>import sys
import os
sys.path.insert(0, os.path.join(os.getcwd(), "../../"))
import pnguin as pg<jupyter_output><empty_output><jupyter_text>Creating some mock data<jupyter_code>ld = [{"name": "Raghav", "info": "idk"}, {"name": "Someone Else", "info": "Something else?"}]
dl = {"name": ["Raghav", "Someone Else"], "info": ["idk", "Something else?"]}
header_csv = os.path.join(os.getcwd(), "../test/data/headerdata.csv")
no_header_csv = os.path.join(os.getcwd(), "../test/data/noheaderdata.csv")<jupyter_output><empty_output><jupyter_text>pnguin supports two primary methodologies to create a DataFrame -- from a variable, or from a CSV file. I've decided to stop with these two for now because to be honest, they're the two most common data sources I use. If you would like to introduce another source, please feel free to open a [PR](https://github.com/raghavmecheri/pnguin/pulls)Note: The point of this library is to keep it lightweight and minimalist! So if you want an alternate datasource that already can pull data out as say, a list of dicts (or a dict of lists!) an extra line to your source code isn't always the worst thing :)  From a list of dicts (or a dict of lists!)<jupyter_code>df = pg.DataFrame(ld, axis="row")
df.head()
df = pg.DataFrame(dl, axis="col")
df.head()<jupyter_output><empty_output><jupyter_text>You can also give pnguin data in row format (list of dicts) and specify a column-axis -- it'll just convert the data for you!<jupyter_code>df = pg.DataFrame(ld, axis="col")
df<jupyter_output><empty_output><jupyter_text>From a CSV file  CSV files both with and without headers work -- pnguin assumes that the first row's a header  If you have a CSV file with headers, it's easy<jupyter_code>df = pg.read_csv(header_csv)
df.head()<jupyter_output><empty_output><jupyter_text>If you have a CSV file without headers, you can also pass an array of headers in<jupyter_code>df = pg.read_csv(no_header_csv, headers=["Name", "Age", "Something", "Something2", "Something3"])
df.head()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12872628726287264, 'fraction_numerical': 0.004968383017163505, 'mean_word_length': 5.857585139318886, 'pattern_counts': {'":': 6, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 2, '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': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '107387', 'license': 'MIT', 'n_tokens_mistral': 755, 'n_tokens_neox': 720, 'n_words': 242, 'path': 'examples/DataFrame/DataFrame Creation.ipynb', 'repo_name': 'raghavmecheri/pnguin', 'size': '2214'}