Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

perform cross tabulation sklearn

pandas.crosstab
pandas.crosstab(index, columns, values=None, rownames=None, 
				colnames=None, aggfunc=None, margins=False, 
                margins_name='All', dropna=True, normalize=False)
                
a = np.array(["foo", "foo", "foo", "foo", "bar", "bar",
              "bar", "bar", "foo", "foo", "foo"], dtype=object)
b = np.array(["one", "one", "one", "two", "one", "one",
              "one", "two", "two", "two", "one"], dtype=object)
c = np.array(["dull", "dull", "shiny", "dull", "dull", "shiny",
              "shiny", "dull", "shiny", "shiny", "shiny"],
             dtype=object)
pd.crosstab(a, [b, c], rownames=['a'], colnames=['b', 'c'])
b   one        two
c   dull shiny dull shiny
a
bar    1     2    1     0
foo    2     2    1     2
Comment

PREVIOUS NEXT
Code Example
Python :: clear notebook output 
Python :: random pick and remove index pandas 
Python :: element tree no able to find tag 
Python :: ring Reverse List Item 
Python :: ring get the type a given path (file or directory) 
Python :: ring Using Self.Attribute and Self.Method 
Python :: easy ocr python pypi 
Python :: candelstick chart matplotlib 
Python :: python graph 
Python :: python dict setdefault list 
Python :: StandardScaler sklearn get params normalization 
Python :: sumy library 
Python :: Use of OfficeApi 
Python :: python message from byte 
Python :: idiomatic python 
Python :: plt.axes muktiple plots 
Python :: python apply file line 
Python :: object creation using class constructor 
Python :: how to resolve This typically means that you attempted to use functionality that needed an active HTTP request. Consult the documentation on testing for information about how to avoid this problem. in thread python 
Python :: granges to string peak 
Python :: tensorboard dev upload in background colab 
Python :: python set prcess name 
Python :: explore data dataframe pandas 
Python :: Python[17586:513448] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to 
Python :: how to read comment before the root element of xml python 
Python :: standardscalar 
Python :: implementation of binary search tree in python 
Python :: negative index python 
Python :: accessing 2d list in python 
Python :: scrapping components of webpage 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =