Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

create pandas dataframe from dictionary orient index

pd.DataFrame.from_dict(data, orient='index',
...                        columns=['A', 'B', 'C', 'D'])
       A  B  C  D
row_1  3  2  1  0
row_2  a  b  c  d
Comment

create pandas dataframe from dictionary orient index

data = {'row_1': [3, 2, 1, 0], 'row_2': ['a', 'b', 'c', 'd']}
>>> pd.DataFrame.from_dict(data, orient='index')
       0  1  2  3
row_1  3  2  1  0
row_2  a  b  c  d
Comment

create a dictionary from index and column pandas

import pandas as pd
df = pd.DataFrame({'Name': ['John', 'Sara','Peter','Cecilia'],
                   'Age': [38, 47,63,28],
                  'City':['Boston', 'Charlotte','London','Memphis']})
df
Comment

PREVIOUS NEXT
Code Example
Python :: python numpy how to empty array cycle 
Python :: how to get parent model object based on child model filter in django 
Python :: range in python 
Python :: Redirect the Python Script Output to File 
Python :: pyqt graph 
Python :: search and replace in python 
Python :: convert method to str python 
Python :: plot dataframe 
Python :: django login required as admin 
Python :: print in python 
Python :: gtk label set label 
Python :: How can I get the named parameters from a URL using Flask? 
Python :: python table code 
Python :: virtual environment python 
Python :: += in python 
Python :: string slice python 
Python :: pd.cut in pandas 
Python :: split range python 
Python :: python basic data types 
Python :: python reverse range 
Python :: convert time python 
Python :: class method in python 
Python :: access list index python 
Python :: typecasting python 
Python :: frequency 
Python :: TRY 
Python :: how to get list size python 
Python :: sorted lambda 
Python :: concatenate strings and int python 
Python :: perfect numbers python 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =