Metadata, also known as data about the data. Metadata can give us data description, summary, storage in memory, and datatype of that particular data. We are going to display and create metadata.
- We can get metadata simply by using info() command
- We can add metadata to the existing data and can view the metadata of the created data.
- Create a data frame
- View the metadata which is already existing
- Create the metadata and view the metadata.
Here, we are going to create a data frame, and we can view and create metadata on the created data frame
View existing Metadata methods:
- dataframe_name.info() – It will return the data types null values and memory usage in tabular format
- dataframe_name.columns() – It will return an array which includes all the column names in the data frame
- dataframe_name.describe() – It will give the descriptive statistics of the given numeric data frame column like mean, median, standard deviation etc.
We can create the metadata for the particular data frame using dataframe.scale() and dataframe.offset() methods. They are used to represent the metadata.
Below are some examples which depict how to add metadata to a DataFrame or Series:
Initially create and display a dataframe.
Then check dataframe attributes and description.
Initialize offset and scale of the dataframe.
We are storing data in hdf5 file format, and then we will display the dataframe along with its stored metadata.
Series data structure in pandas will not support info and all methods. So we directly create metadata and display.
Now we will store the metadata and then display it.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course