<jupyter_start><jupyter_text>Turning python-fmrest foundset into DataFrame This is a short example on how to easily build a Pandas DataFrame from a Foundset.Here you can find information about [Pandas](http://pandas.pydata.org) and [DataFrames](http://pandas.pydata.org/pandas-docs/stable/dsintro.html) and how you can work with these data structures when analysing data.For this example, make sure to first install Pandas (`pip install pandas`) and optionally Matplotlib (`pip install matplotlib`).<jupyter_code>import fmrest
from pandas.plotting import parallel_coordinates
from matplotlib import pyplot as plt
%matplotlib inline<jupyter_output><empty_output><jupyter_text>Create server instance and login First, we create our server instance just like in the examples before.<jupyter_code>fms = fmrest.Server('https://10.211.55.15',
                    user='admin',
                    password='<PASSWORD>',
                    database='Contacts',
                    layout='Iris',
                    verify_ssl=False,
                    #type_conversion=True #Danger!
                   )

fms.login()<jupyter_output><empty_output><jupyter_text>If you have numbers in text fields or want to work with dates, you can try out `type_conversion=True`.**Note**: As this "type-guessing" can, at times, lead to unexpected results, I strongly recommended you to do the type conversion yourself when working with your own "known" data fields.  Fetch records from server Let's fetch all data from our Iris layout as specified above.(When you have more than 100 records to fetch, make sure to specify the `limit` parameter as the Data API defaults to 100 records.)<jupyter_code>foundset = fms.get_records(limit=150)
foundset<jupyter_output><empty_output><jupyter_text>Turn foundset into DataFrame Now that we have our Foundset instance, the only thing we need to do is to call the `to_df` method. This will give us a Pandas DataFrame.Let's look at the first 5 rows.<jupyter_code>df = foundset.to_df()
df.head()<jupyter_output><empty_output><jupyter_text>Since we are not interested in `recordId` or `modId`, we just drop them.<jupyter_code>df.drop(['recordId', 'modId'], axis=1, inplace=True)
df.head()<jupyter_output><empty_output><jupyter_text>Before working with your data, check that the types are OK (previous versions of the Data API always returned strings and ignored the data type set in your DB schema).<jupyter_code>df.dtypes<jupyter_output><empty_output><jupyter_text>Going from here With your DataFrame ready, you can go on analyzing and plotting your data as you wish...<jupyter_code>plt.figure(figsize=(12, 12))
parallel_coordinates(df, 'class')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08478988471550762, 'fraction_numerical': 0.008925251022685012, 'mean_word_length': 4.651260504201681, 'pattern_counts': {'":': 0, '<': 30, '<?xml version=': 0, '>': 30, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, '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': '147108', 'license': 'MIT', 'n_tokens_mistral': 813, 'n_tokens_neox': 769, 'n_words': 285, 'path': 'examples/dataframes_for_analysis.ipynb', 'repo_name': 'steveWinter/python-fmrest', 'size': '2684'}