How to create dataframe for testing?
Did you ever wanted to create dataframes for testing and find it hard to fill the dataframe with dummy values then DO NOT Worry there are functions that are not mentioned in the official document but available in pandas util modules which can be used to create the dataframes and we will explore those methods in this post.
Here are the functions that you can directly use to create the test dataframes
Random DataframePermalink
it creates a dummy dataframe with random real number of 4 columns A,B,C,D
The index is a group of alpha-numeric character
from pandas import util
df= util.testing.makeDataFrame()
df.head()
Missing DataframePermalink
It creates dataframe with missing values in it. You can see those NaN values in Column A
df= util.testing.makeMissingDataframe()
df.head()
Time DataframePermalink
It creates the time-series dataframe
df= util.testing.makeTimeDataFrame()
df.head()
Mixed dataframePermalink
It creates a mixed dataframe containing Categorical, date-time and Continuous columns
df= util.testing.makeMixedDataFrame()
df.head()
Period FramePermalink
It creates time-series dataframe with periodical data
df=util.testing.makePeriodFrame()
df.head()