Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

display column names as a dictionary pandas

import pandas as pd

df = pd.DataFrame({'date': ['2015-01-01', '2015-01-02', '2015-01-03'],
                   'value': ['a', 'b', 'c'],
                   'num': [1, 2, 3]
                   })

print(df)
print({c: i for i, c in enumerate(df.columns)})
Comment

PREVIOUS NEXT
Code Example
Python :: ros teleop 
Python :: Python use number twice without variable 
Python :: import combination 
Python :: beautifulsoup remove tag with class 
Python :: python toupls 
Python :: how to find the no of user for a wifi using python for ubuntu 
Python :: gpu DBSCAN python 
Python :: re.search 
Python :: string in netcdf file python 
Python :: start ipython with any version 
Python :: end without space in python 
Python :: python C-like structs 
Python :: inverse of a matrix with determinant 0 python linalg 
Python :: pandas check length of string 
Python :: rename files in python 
Python :: pygame get surface region 
Python :: state capitals python 
Python :: looping through the list 
Python :: Python NumPy asfarray Function Example Tuple to float type array 
Python :: convert int to ascii python 
Python :: odoo manifest 
Python :: flask arguments in url 
Python :: Access Google Photo API with Python using google-api-python-client 
Python :: PySimpleGUI all elements 
Python :: capitalise texts 
Python :: scroll to top selenium python 
Python :: tuple push 
Python :: or en python 
Python :: Set path for another directory 
Python :: pandas change period 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =