<jupyter_start><jupyter_text>Random tests  Comparing types<jupyter_code>type(5)
type('hello')
type('hello') == str
type('hello') is str<jupyter_output><empty_output><jupyter_text>Dataframe attributes<jupyter_code>import pandas as pd
data_dict = {"A":[1,2,3]}
df = pd.DataFrame(data = data_dict)
df
df.attrs['thing'] = 'stuff'
df.attrs<jupyter_output><empty_output><jupyter_text>Slicing arrays<jupyter_code>import numpy as np
test_slice = np.s_[0:512,0:512]
test_array = np.ones((512,512))
test_array[None]
test_slice[0].stop<jupyter_output><empty_output><jupyter_text>Initializing a GaussianResult<jupyter_code>from data_analysis.signal_calculators import GaussianResult
GaussianResult(1,1)<jupyter_output><empty_output><jupyter_text>Pandas dataframe setting on copy of a slice<jupyter_code>import pandas as pd
df = pd.DataFrame(data = {'a':[1,2,3], 'b':[1,2,3]})
df['c'] = df.a/df.b
df['c']<jupyter_output><empty_output><jupyter_text>Saving dataframe to hdf<jupyter_code>import pandas as pd
df_test = pd.DataFrame({"a" : [1,2,3]})
df_test.attrs["test"] = 1
df_test.attrs
df_test.to_hdf("test.hdf", "test_key", 'a')
df_load = pd.read_hdf("test.hdf")
df_load.attrs<jupyter_output><empty_output><jupyter_text>Reading data from hdf<jupyter_code>fname = f"D:\Google Drive\CeNTREX Oskari\State preparation\SPA\Data analysis\Analyzed Data\SPA_test_11_9_2021_analyzed.hdf"
df = pd.read_hdf(fname)
df.attrs
df<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14814814814814814, 'fraction_numerical': 0.026554856743535988, 'mean_word_length': 9.766917293233083, 'pattern_counts': {'":': 1, '<': 29, '<?xml version=': 0, '>': 29, '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': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '131481', 'license': 'MIT', 'n_tokens_mistral': 611, 'n_tokens_neox': 589, 'n_words': 87, 'path': 'src/Random tests.ipynb', 'repo_name': 'otimgren/centrex-data-analysis', 'size': '1431'}