Pandas > Create dataframe from dictionary

Name
Code
Output
# creating dataframe from dictionary allows to specify different data source/type for each column

dataframe = pandas.DataFrame({
    'C1': pandas.date_range('20170101', periods=4),
    'C2' : [10,20,30,40],
    'C3': pandas.Categorical(['A','B','C','D']),
    'C4': 1})
print ("dataframe")
print (dataframe)
dataframe
          C1  C2 C3  C4
0 2017-01-01  10  A   1
1 2017-01-02  20  B   1
2 2017-01-03  30  C   1
3 2017-01-04  40  D   1