Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

numpy dataframe

pd.DataFrame({"A": [1, 2], "B": [3, 4]}).to_numpy()
array([[1, 3],
       [2, 4]])
       
       
data = np.array([['','Col1','Col2'],
                ['Row1',1,2],
                ['Row2',3,4]])
                
print(pd.DataFrame(data=data[1:,1:],
                  index=data[1:,0],
                  columns=data[0,1:]))
Comment

PREVIOUS NEXT
Code Example
Python :: string + string in python 
Python :: # Python string capitalization 
Python :: python catch int conversion error 
Python :: check dictionary values pandas dataframe colu 
Python :: python Sum of all the factors of a number 
Python :: switch case python 3.10 
Python :: insert-cells-in-empty-pandas-dataframe 
Python :: conda create new env 
Python :: how to put space in between list item in python 
Python :: duplicate a list with for loop in python 
Python :: assign multiple columns pandas 
Python :: dimension of an indez pandas 
Python :: python reply to email 
Python :: identity matrix with numpy 
Python :: python linter online 
Python :: how to create dictionary in python 
Python :: package in python 
Python :: pandas dataframe apply 
Python :: Check version of package poetry 
Python :: how to handle response from tkinter messagebox.askquestion() function in Python 
Python :: python comments 
Python :: python using secrets 
Python :: Python DateTime Date Class Example 
Python :: python string: .format() 
Python :: python output text 
Python :: How to shift non nan values up and put nan values down 
Python :: python local nosql database 
Python :: selecting rows with specific values in pandas 
Python :: fast api template syntax 
Python :: python TypeError: function takes positional arguments but were given 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =