import pandas as p pythonList = ['banana','apple','banana','pear','banana','pineapple','apple'] pandasDataFrame = p.DataFrame( pythonList , columns=(['Fruit Name']) ) pandasSeries = pandasDataFrame.groupby(['Fruit Name']).size() print pandasSeries
2016-12-18
Python - How to tabulate list item occurrence frequencies (histogram), equivalent to R's table function
2016-12-12
MySQL - How to restore a dump file (command-line)
/usr/local/mysql/bin/mysql -u root -p
mysql> create database DATABASE_NAME;
mysql> use DATABASE_NAME;
mysql> source DUMP_FILE_NAME.dmp;
Substitute "root" with a more appropriate user, if any.
mysql> create database DATABASE_NAME;
mysql> use DATABASE_NAME;
mysql> source DUMP_FILE_NAME.dmp;
Substitute "root" with a more appropriate user, if any.
2016-12-11
Python - Remove multiple contiguous characters, leaving only one
re.sub( ur"([-])\1+", r"\1", string_here )
Where - is the character being sought.
print re.sub(ur"([-])\1+", r"\1", "111-112,120----130,1-1,2--2,3---3,4----4,5-----5,8" )
111-112,120-130,1-1,2-2,3-3,4-4,5-5,8
Where - is the character being sought.
print re.sub(ur"([-])\1+", r"\1", "111-112,120----130,1-1,2--2,3---3,4----4,5-----5,8" )
111-112,120-130,1-1,2-2,3-3,4-4,5-5,8
2016-12-05
MacOS - How to set JAVA_HOME environmental variable
Customize the path to the one in your system, and add this line to ~/.bash_profile
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/
MacOS - How to view all environmental variables and their values
printenv
(rum that command on terminal)
(rum that command on terminal)
2016-11-27
R - Load a text file into a variable
variable_name <- b="">scan->
("path/to-file.txt", what="character", sep="\n")
("path/to-file.txt", what="character", sep="\n")
2016-11-26
Subscribe to:
Posts (Atom)