Ad

Thursday, December 28, 2017

Using Python Pandas to analyze and visualize financial data

Using Pythons pandas to analyze and visualize financial data http://pandas.pydata.org/pandas-docs/version/0.13.1/visualization.html Visual examples include multi axis plotting, subplots, bar chart, stacking bar chart, box plot aka candle stick plot, sample code making a scatter matrix, seaborn kernal density estimation (kde) plot, Andrew Curves, Parallel Coordinates, Lag Plot, AutoCorrelation Plot, Bootstrap Plot, RadViz, ColorMaps,

Shapeways Free 3D Model Checking Tool

Shapeways 3D printing shop / factory free 3D model checking tool, resource https://www.shapeways.com/getting-started/3d-tools

Wednesday, December 27, 2017

LRU Cache Android Development Pattern

Beyond understanding LRU aka least recently used cache for technical interview here is another reason to learn the technique: you can actually use this in Android development

https://youtu.be/R5ON3iwx78M

Tuesday, December 26, 2017

Kadane's Algorithm - Maximum Subarray Problem




The Maximum Subarray Problem using Kadane's Algorithm

https://en.wikipedia.org/wiki/Maximum_subarray_problem

History and Trivia of Kadane's Algorithm

The Maximum Subarray Problem using Kadane's Algorithm

https://en.wikipedia.org/wiki/Maximum_subarray_problem

Maximum Likelihood Estimation

https://en.wikipedia.org/wiki/Maximum_likelihood_estimation

Upon observing data, what is the likelihood of the original population distribution. 

Going on a tangent to Bayesian Statistics

https://en.wikipedia.org/wiki/Bayesian_statistics

Udacity video explains Maximum Likelihood Statistics Problems


Sebastian Thrun of Udacity explains Maximum Likelihood Estimator




Deriving Maximum Likelihood Estimator, Proof



Proof Mean MLE




Friday, December 22, 2017

Topics of Deep Learning with Tensorflow

Examples of Deep Learning: Deep Learning is widely used in Google for its features and apps such as Google Photo. More generally it is used for recognizing images, understand natural languages, helping robots interact with the world. Also computer vision and speech recognition, two of the hottest fields all fall into Perception.

Some technical terms you may encounter when studying deep learning Logistic Classification Stochastic Gradient Descent, Data and parameter tuning, Regularization, Convolutional Networks, Embedding, Recurrent Models

Understanding XOR in machine learning

An analogy of XOR is a person can not physically be at two places at the same time. So both of the input cannot be True. True XOR True is False. Another way to think about XOR is that XOR = OR - AND. That is to say XOR is everything OR stands for except the AND part.

Prepping the data, data preprocessing in machine learning

Post construction in progress. This is a draft.
Things to consider when prepping data:

Use exploratory data analysis to understand the distribution of your data, helps scout out opportunity of regularization, normalization, feature selection and model selection.

If you have hundreds of features, feature selection can be very effective. Dimensionality reducFion can help simplify the data, generate better results, faster results. It also makes sense to only retain features that actually can predict the labels.

You can cut your dataset into even smaller more manageable subsets by sampling the data.

It’s a standard procedure to further divide the input dataset into train and test splits with shuffling. But some datasets do not do well with shuffling such as time series data. We cannot simply mix past data with present and future. 

Is data linearly separable? SVM can employ different kernels to handle non-linear data. RELU and Sigmoid also generates non-linear output.

Data Transformation

sklearn.preprocessing.Imputer Imputation transformer for completing missing values. Handling missing value, process and replace NaN with mean, median, most_frequent etc.


Celebrating 200000 views milestone

Thank you for your support! We have reached 200000 views! A true milestone. Continue to follow us for coding tutorials, silicon valley news, lifestyle and jobs at subscribe@uniqtech.co


Implementing a Trie in JAVA by Cracking the Coding Interview Author Tutorial Recommendation

This Trie tutorial in JAVA is by Cracking the Coding Interview (the bible of coding interview) author Gayle Laakmann Mcdowell for Hacker Rank Youtube Channel. The explanation is crystal clear and very helpful. Too bad it is not in Python, but it gets the idea across. 



Wednesday, December 20, 2017

Coin Change Problem with Memoization and DP by Cracking the Coding Interview Author Tutorial Recommendation

The key to the coin change problem is Dynamic programming coin change with and without the coin. Start from bottom up rather than largest denomination to small. 

This is another coin change problem tutorial we recommend. This one is by Cracking the Coding Interview (the bible of coding interview) author Gayle Laakmann Mcdowell. The explanation is crystal clear and very helpful. The only thing it didn't cover in depth is the idea of using a coin (reduce sum) and withholding a coin (not reducing the sum) while increasing the index to process the next coin. This is also a memoization and dynamic programming problem.







Previously we recommended Coin Change problem by O'Neill Code. That one uses a bottom up greedy approach to solve for smaller denominations. Then add the ways up as approaching bigger denominations. http://www.siliconvanity.com/2017/11/coin-change-problem-dyanmic-programming.html

Tutorial highlights

Visualize using a coin versus not using a coin

Gayle Laakmann Mcdowell helps visualize using a coin vs withholding a coin.

Visualize the need for memoization

Using 50 cents is equivalent to using two 25 cents. The same sub problem appears when the original problem is reduced. Amount is now 29 cents. If we don't use dynamic programming we will be repeating work. 
Hacker Rank tutorial video coin change problem
Other tutorials that cover the coin change problem include Geek for Geeks, Interview Cake (there are some pluses and minuses, the variable names are a bit hard to read, but the code has a python version!). Most sample codes are in JAVA.

Coin Change Problem with Memoization and DP by Cracking the Coding Interview Author Tutorial Recommendation

This is another coin change problem tutorial we recommend. This one is by Cracking the Coding Interview (the bible of coding interview) author Gayle Laakmann Mcdowell. The explanation is crystal clear and very helpful. The only thing it didn't cover in depth is the idea of using a coin (reduce sum) and withholding a coin (not reducing the sum) while increasing the index to process the next coin. This is also a memoization and dynamic programming problem.







Previously we recommended Coin Change problem by O'Neill Code. That one uses a bottom up greedy approach to solve for smaller denominations. Then add the ways up as approaching bigger denominations. http://www.siliconvanity.com/2017/11/coin-change-problem-dyanmic-programming.html

Tuesday, December 19, 2017

Insert with SQL — CRUD with SQL Database

Add information into a SQL table
INSERT INTO
tables_name
(col_1, col_2, col_3)
VALUES
(‘value_1’, ‘value_2’, ‘value_3’)
Tiny tutorials delivered to you by Uniqtech. We are bootcamp and beginner friendly. Learn to code with us!

Sunday, December 17, 2017

Serialization - A Crash Course - Best Serialization Tutorial

This video tutorial on Youtube is excellent it walks through the high level concept of serialization - compression, optimization and some common types of serialization like JSON YAML and XML. Great effort.



Getting started with Python Pickle Module for saving objects (serialization)

Pickle can serialize any python objects. Everything in Python is an object so technically many python components can be pickled. The concept is we can save any object and data objects in python into pickle format, of which we can load later, much like csv.

Turn a variable called my_dataframe, my variable name for a Pandas Dataframe into a pickle file with extension pkl.
my_dataframe.to_pickle(file_name)





This tutorial introduces the idea of pickling of Python objections, Python Dictionaries for better loading speed, optimization and note pickling is used in Machine Learning as well.

Pandas Vectorized Methods - Intro to Data Science


This Udacity data vectorization video shows that Dataframe.apply(Numpy.mean) can be used to calculate column mean. Pandas allow easy vectorization of data charts. DataFrame['col_name'].map(lambda x: x==0) check each data cell in the column if it is equal to zero. DataFrame.applymap(lambda x: x ==0) will check each data cell in the entire dataframe.

Subscribe to our blog. We help discover the best tutorials on technology and programming subscribe@uniqtech.co we are beginner and bootcamp friendly.

Vector math is not only optimized, speed wise, it's also clean and elegant.

Bird Dog - Restaurants of Silicon Valley

Ultra modern, ultra abstract from plates to decors of flying wooden decoys / ducks, and ingredients, this place screams modern trend and  innovation. Chef Robbie Wilson worked at The French Laundry and Matsuhisa (Nobu Matsuhisa, hot hot hot in SoCal). Get Wagyu, Duck and other specialty dishes at this Palo Alto gem, in the heart of Silicon Valley. And dine here to brush shoulders with the giants! Literally ran into Mark Zuckerberg here. Well, he didn't put up a private screen while dining, we should also respect his privacy. According to Silicon Valley magazine, table No. 31 is the chef's table that overlooks all the open kitchen actions.

Visualize Random Uniformly Distribution of Data

Visualize what a random uniformly distribution of data would look like.

http://www.sthda.com/english/wiki/print.php?id=238
K Nearest Neighbor (KNN) lookup will have a hard time dealing with this distribution. It's practically random.

What's the difference between uniform and random? Here're two illustrations from Britannica that do the job of explaining. Visit their web page below.

https://kids.britannica.com/students/assembly/view/108151


Banking on Bitcoin - Netflix's New Documentary on Bitcoin

What is Bitcoin? Bitcoin for dummies? Netflix's new Banking on Bitcoin helps you get started learning about the crypto currency in hype.

If you are reading my blog, chances are you love technology, Silicon Valley and the clout of it all. Chances are you are aware that Bitcoin just skyrocketed and now it is even offered on the stock exchange for improved liquidity. This blog is not about investment, not about bitcoin but about Netflix's new documentary on the subject.

Banking on Bitcoin Netflix

This documentary features interviews with experts, enthusiasts and opportunists of this crypto currency. Subtitles including English, Spanish, Chinese and French! Think of as a quick overview of Bitcoin's past and future to get you started.
For those who studied Netflix's business model, you might be aware of netflix's strategy to target niche interests since its founding: indie films, documentaries, foreign cinema and more. Recently it really stepped up original series like House of Cards and Stranger Things. It nature documentaries reservoir is arguably the best on the internet, except it's not playing Planet Earth 2. Have you seen Tales by Light? It's gorgeous.  Have you seen Chef's Table? Delicious! What about that documentary on becoming Warren Buffet? Lovely narrative about nuances of Warren's life. This new documentary is definitely a perfect fit for this niche pipeline. Popular but not mainstream? You can probably find it on Netflix. Youtube too, but less interrupted on Netflix. These are not the Netflix and Chill movies though.

Startup Guide to Silicon Valley Tech - Books and Movies Recommendations

Moving to Silicon Valley? Looking for the next startup job gig? Here are some movies, documentaries and books you might want to watch and read before starting your journey to become an unicorn.

Know your unicorns

Not all unicorns are sexy startups. Here's a list of true unicorn companies by Wall Street Journal


Joining the next YC batch? How to get into Y Cominbator as told by insiders

First of all, probably follow Hacker News. Second of all, try to qualify for the annual Startup School. There is a female exclusive Female Founders Conference by YC as well. Here are some past highlights from YC Startup School.

http://www.siliconvanity.com/search?q=y+combinator
http://www.siliconvanity.com/2013/10/y-combinator-startup-school-2013.html
http://www.siliconvanity.com/2013/10/y-combinator-startup-school-2013_21.html


Have you heard of the No.1 Startup Accelerator in America and in the World? Yes, the investor of Dropbox, Airbnb, Reddit, Stripe, Zenbenefits, Instacart and Weebly - some of the biggest startup and "unicorns" in the Silicon Valley. They have only invested in 940 companies so far. The odds are high. Want to get into YC? Besides talking to real YC alumni and founders you should probably read these books. And of course the essays by the "godfather" of the startup world Paul Graham, former YC partner and chief.



The Launch Pad: Inside Y Combinator

A peel-the-onion view for looking inside the heart of Y Combinator, the most sought-after accelerator of the world.  Written by a New York Times Columnist and Stanford History PhD. It's a professionally written book looking at the seemingly chaotic world of startups.  Reviewed by world renowned venture capitalist  Marc Andreessen. 



Review

“Y Combinator is a national treasure, a Silicon Valley seed fund that is mass-producing new startups. Randall Stross’s behind-the-scenes look at YC offers a rare glimpse into what it really takes to conceive an idea and get it to market as quickly as possible. The Launch Pad is a must-read for anyone interested in the realities of modern entrepreneurship.”
—Eric Ries, author of the New York Times bestseller The Lean Startup
“The Launch Pad is an intimate look at the white-hot center of the new Silicon Valley star tup ecosystem. Stross’s account of the best new entrepreneurs and the exciting companies they’re building at startup schools is a great read for founders and would-be founders alike.”
—Marc Andreessen, cofounder, Andreessen Horowitz

About the Author

Randall Stross writes the “Digital Domain” column for the New York Times and is a professor of business at San Jose State University. He is the author of several acclaimed books, includingeBoys, Planet Google, and The Wizard of Menlo Park. He has a Ph.D. in history from Stanford University.

Guide to YC  - what's YC and how to get in by an alum


  


Paul Graham: The Art of Funding a Startup (A Mixergy Interview)


While you should probably just read  Paul Graham's essays for free from his renowned collection of well written essays - http://paulgraham.com/articles.html you can also buy this book compiled by professionals and publishing houses. 


While many in the silicon valley has laughed at the accuracy of these movies blow. They are rather sensational romantic stories about the Silicon Valley and founders who created empires here. We recommend the hit TV show Silicon Valley, The Social Network (Movie), and The Internship to get started romanticizing about becoming big in the Silicon Valley. 
  

These motion pictures surely are fun to watch quickly and get a sense of the startup culture in the Silicon Valley.


More startup bibles that you can read


Binge watching Silicon Valley (the TV show) already? We have the perfect book recommendations for you if you are finding "romance" in the Silicon Valley startup world. These are legit hustle blockbusters recommended by real Silicon Valley founders and YC alumni.

The Lean Startup by Eric Ries



Zero to One Peter Thiel Startup Venture Capitalist of the Year




The Startup Playbook: Secrets of the Fastest-Growing Startups from Their Founding Entrepreneurs



But ultimately remember Paul Graham the godfather and mafia chief of YC said focus on your product. Eat exercise and product. That's it. No books :)

Saturday, December 16, 2017

Make art with code

Make plotter art using AxiDraw a machine that looks like a prototype and still costs hundreds of dollars but is capable of holding pens and pencils make precision art of lines, pictures, patterns. Take any drawing or art, lettering and calligraphy, run it through a program that generates artistic data from your underlining image (example deciding which dots to plot in what pattern) and in 30 lines of code, you can get this 2D printer like machine to draw anything on paper.

Want to make tripy surreal art with Machine Learning? Google’s deep dream let you do just that. There’s a twitter account that highlights deep dream artworks. http://www.siliconvanity.com/2017/12/google-cs-first-teaches-you-how-to-make.html?m=1

Google CS First class teaches you how to make animated Google Doodles with simple codes.

Friday, December 15, 2017

Google CS First Teaches You How to Make Google Doodles Google Logos

This teach how to code, learn programming tutorial by Google teaches you how to create and animate Google Doodles, Google Logos that change on a daily basis to reflect current event and highlight heroes and accomplishments of the past.

How to make Google Doodles
You can learn to make caricatures (sprites) bounce, spin, ... animate them, change scenes change backgrounds and more. It's quite cool. https://csfirst.withgoogle.com/en/hoc2017

Subscribe subscribe@uniqtech.co follow us as we continue to highlight the best learn to code tutorials and experiences from learning to code to machine learning and beyond.

Wednesday, December 13, 2017

What is a Neural Network - Best Machine Learning Tutorials

Neural networks are important for ML as well as artificial intelligence and deep learning. This Youtube channel explains NN in depth. Take a look.



How to Rotate a Matrix by Gayle Laakmann McDowell - Author of Cracking the Coding Interview

Great tutorial highlights by author of the most popular technical interview prep book Cracking the Coding interview.





Personally because this particular problem is tedious I like to read blog format tutorials. I feel that written format works better for this question and the matrix spiral problem. This is one of the best video format I can find.

Reverse a Linked List in Python - Technical Interviews Programming Interview

Take a moment to think about what would the data structure of a linked list look like in Python.

class Node:
     def __init__(data):
          self.data = data
          self.next = None

Each element of the Linked List is a node which contains data and a next pointer.

We use pointer to indicate a Python variable, which is not the same as the * operator.

To reverse a Linked List, you have to recursively put the current head as the previous node, the list head will become the second to last element and points to None, while the list tail is now the new head.

It's assume that the Linked List has a head pointer just like all Linked Lists defined by its abstract data structure (ADS)

current = head
prev = None
next = None

while current:
     next = current.next
     current.next = prev
     prev = current
     current = next
return prev

It gets a bit confusing in the middle. It's important to remember that the previous pointer starts with None, because the old head points to None after being reversed. Next serves as a temp pointer, we need to temporarily store current.next, and change it to previous. Since we just completed processing the current node, we store it in the new prev variable, which has the current and new current.next.  Then store the next node as the current node. The order matters when assigning current.next and the new current.

Monday, December 11, 2017

Finding Repeats in an Array or a List - Technical Interview in Python Patterns

Practice using Hash map.

def find_repeat(numbers):
seen = set()
for n in numbers:
if n in seen:
return n
else:
seen.add(n)
return False #if no duplicate found

Instead of returning False, you can also raise an exception. Use this:
raise Exception('custom exception message here')

Getting started with theme development - theme development resources

Ready to make money on the internet? Well, hold your horses, it is not that easy, but developing themes is free to start, though time consuming to optimize, but once you have a product, you can deploy it on any platform. Here are some resources to get you started!

Free themes and giveaways can attract followers, ratings and get you started in the theme business

Shopify Theme and Shopify Partner Program

Shopify allows you to take a cut from retail store subscriptions and sell your themes. You can fetch up to $120 - $2000 dollars. 

Tumblr Custom Themes

Get inspired by Tumblr themes here https://www.tumblr.com/themes/
Get educated and get inspired. Tumblr themes go up to $49 dollars and more.
https://www.tumblr.com/docs/en/custom_themes

Know your artists

Animators and manga artists are thriving on Tumblr. If you were to monetize on tumblr, make sure you know your audience. Here's an example of an artist blog on Tumblr http://tzysk.tumblr.com/ Here''s another thousandskies.tumblr.com


What's a beginner friendly tutorial for getting started with theme development on Tumblr?

Apparently General Assembly Dash has a Tumblr Theme project. It guides you throw basic HTML and CSS and essentially that's what you need to get started. It will walk you through creating a basic bubble shaped profile picture and an input field to collect email addresses.

Amazon supports native ads on Tumblr

Technically Amazon supports banner displays and CPM ads on Tumblr but implementing it on the Tumblr side is a different issue all together. Pay attention Tumblr community guidelines and term of services is always the way to go.


Take Advantage of the Build-in Viral Factors

As someone who has done a lot of social media and content marketing, I think Tumblr has the most re-sharable form of blog posts. It's almost as instant as Favoriting a post. The newcomer with this prowess is Medium. Customize themes should not hinder this experience. In fact, it should highlight social shares and showcase them. 

Sunday, December 10, 2017

Great Adobe Tutorial : Basics of Smart Objects :: Photoshop Tutorial

Manipulate smart objects in Adobe Photoshop



Great Adobe Tutorial : Basics of Smart Objects :: Photoshop Tutorial

Manipulate smart objects in Adobe Photoshop



New Google Doodles Teaches Kids How to Code

Celebrating 50 years of kids coding and the learn to code movement, Google Doodle let's visitors play a mini bunny (rabbit) chases carrots game. Player will solve the puzzle using drag and drop (much like MIT Scratch and other beginner, kids friendly learn programming languages). It's easy for players to drag and drop loops, forward, turn left and turn right to command the bunny. The loop block is quite smart, can automatically resize based on how many other individual blocks it contain.  These puzzles are not trivial. To beat the levels, players need to experiment and think hard about the logic.



The real challenge is to get the optimal solution. If you have beat a level with the optimal route, you will get a ribbon!


You can access this coding game in the Google Doodles archive: https://www.google.com/doodles/celebrating-50-years-of-kids-coding

To learn more about learn-to-code resources, news and career job opportunities subscribe to our blog! We cover learn to code and we were featured on Fast company Venture Beat and TechCrunch!

subscribe@uniqtech.co
subject: Learn to Code

Saturday, December 9, 2017

Natural Language Processing with Python

A trick to test input type str.isalpha() str.isalnum()
For example 'a'.isalpha() == True -> True, '5'.isalpha() == True -> False
isalpha() only returns true if the string is completely alphabetical.
numbers need to use isalnum() which refers to is alpha numerical
More string type tricks here https://docs.python.org/3/library/stdtypes.html including how to check for spaces.

Sudoku Solver using Python Technical Interview Question

In this post, I want to share two tutorials for learning to implement a Sudoku Solver in Python. One is from Geeks for Geeks http://www.geeksforgeeks.org/backtracking-set-7-suduku/ I like the code base and especially the 3 x 3 box logic. But I think it could have been improved implementing a Sudoku solver class. The variables can be made more readable and self.grid, self.loc can be instance variables, then it's easier to pass them into the methods find_empty_loc(), used_in_row() etc. It was hard for me to understand the video tutorial of Geeks for Geeks because the audio quality is quite jarring.  Quinston's video explanation is more elegant, but the code is less readable, especially the 3 x 3 grid logic. If you find better solutions please let me know. Here's my implementation of this Sudoku Solver in Python loosely based on Geeks for Geeks with more pythonic variable names and method names. https://github.com/theoptips/technical_interview/blob/master/sudoku_geek.py



Friday, December 8, 2017

CS50 - Behind the Internet's most popular computer science MOOC class

Behind the massively popular CS50 class

Now the most popular computer science class in the history of computer science. Creator, however Professor David Malan has attracted over 1 million students World wide including Emerging tech hubs like India and Brazil. The Harvard professor attributes his success to newly found the popularity of computer science as a field,  but the editor and author of departure seems to think it is because of David's natural showmanship. He is very good at employing props and leveraging industry experts. His class has also attracted prominent guest speakers such as Facebook founder Mark Zuckerberg. David has turned this traditional content into the new online medium. Cs 50 really stands out among 7000+ MOOCs among coursera Udacity and edx emerged as 3 major platforms. 


The entire course lecture is free on Youtube. My personal favorites are CS50 shorts, excellent for quickly getting started on a new concept or reviewing an old one. Awesome CS50 shorts include Ruby on Rails, PHP, Sorting Algorithms and more.


The curriculum improves every year. The 2017 lecture series include:



https://www.youtube.com/watch?v=y62zj9ozPOM&list=PLhQjrBD2T3828ZVcVzEIhsHVgjANGZveu


The curriculum is comprehensive and informative. I recommend every bootcamp graduate and people learning to code, learning to program to quickly watch all lectures to solidify your coding foundation. Pro tip: use youtube 1.5x speed.


Python Dictionary, hash map a very useful data structure in technical interviews

When brainstorming solutions in an interview, the first thought is to start with a brute force solution, then what? Gaye of Cracking the Coding Interview mentions that hash map should be the first data structure to think about. It is incredibly useful and versatile, retrieval is only O(1) and space is at most O(n) because there is no repeat in keys. 

Median the undervalued summary statistics - technical interviews

Usually medians are quickly glossed over in college statistics classes and beginner coding courses. It's a simple concept : pick the middle number in a sorted dataset. Turns out that sorting is non trivial in large datasets so finding the median is harder in real life. Also know it depends on whether the dataset has even or odd number of data points. Recursively partition data by the median of subpartitions helps break sorted data into chunks that are easy to store and retrieve. It also makes binary search much easier.

A slightly challenging interview question is finding the median or two sorted arrays. The solution is nontrivial. 

Technical interview formats - programming interview at Google what to expect

IPInterview formats at Google for Software Development Engineer (SWE):

For the phone ingdrview:

It is recommended that the interviewee wears headphones in order to free hands for coding. 

Google Hangout audio or even video and Google Document (real time typing and pseudo code, code sharing). A fast internet connection is a must.

Make sure Hangout has access to your camera and microphone.

Choose a noise free environment. 

On-site interview includes whiteboard sessions and one lunch meeting. 

Statistics understanding why average can be misleading

Franklin Leonard responded to press secretary to explain statistics in layman's term. He say if 10 apples are given to 1 person, on average every one has an apple yet 9 people will be mad because the wealth, in this case apple is unevenly distributed. 

This does not have to be political. Often average or mean is not the only summary statistics reported. Median, variance, distribution are all helpful and present for good reasons.

Bitcoin and relationship joke

Here's an internet find: a girl named Kate dumped her then boyfriend John for working on Bitcoin when it was unknown and then this happened


Get it? You need to look at the dates too. She finally realized the grave mistake.

Thursday, December 7, 2017

String Manipulation in Python - Technical Interview with Python for Bootcamp Graduates

What would happen if you try to split an empty string? '' Will it throw an error?

''.split()

Answer:

-----
No. It will return an empty Python list array.
-----

What would happen if you try to join an empty array? [] Will it throw an error?

''.join([])

Answer:

-----
No. It will return an empty string ''.
-----


Make a cat class - Programming jokes

Here's a joke question to test your Objected Oriented Programming (OOP) skills. How would design a cat class? What are some of the features to consider?

Answer: my cat class should have functions that satisfy a cat's essential needs. Here's my pseudo code.

class cat:
eat()
sleep()
internet()


THE END

Integer Overflow in Python - Python for Technical InterviewsProgramming Interviews Series

How to handle large integers in Python?
Unlike other lower level programming languages. Python can dynamically resize arrays and integers to fit larger data. You are less likely going to run into integer overflow issues in Python. Also less likely going to have to worry about bit manipulation. What if this question comes up in an interview?

You can use float('inf') to represent positive infinity and - float('inf'), read it as negative infinity casted as a float, to represent really large negative number. Note you are casting the number as a float not as integer.

More familiar with the notion of MAXINT from JAVA? You can use an external module to cast integers. The module is called sys


import sys 
my_max_num = sys.maxint 
my_min_num = -sys.maxint


Here's a tip for beginners: why is this useful? Let's say you are asked to find a min in an array, which can contain both positive and negative numbers. You may want to initialize current_min as -sys.maxint

https://github.com/theoptips/technical_interview/blob/master/stock_profit_basics.py

Why not just set it equal to negative one? Well the array can contain other negative numbers smaller than one so that wouldn't work.

Uniqtech Technical Interview with Python series is geared towards learn to code, learn programming beginners and bootcamp grads. subscribe to our newsletter
subscribe@uniqtech.co
subject: technical interview with python

float('inf') will result in a floating point number. That's not always the desired result.  Turns out, we can also get a maxint estimate from the sys module.

>>> import sys
>>> sys.maxint
9223372036854775807

The above behavior is Python 2.x 
The difference between Python 2.x and Python 3 can be viewed here. https://stackoverflow.com/questions/7604966/maximum-and-minimum-values-for-ints

Wednesday, December 6, 2017

Reverse a Python List in Place


There are two easy ways to reverse Python in place shown in this beginner Python tutorial. 

l = [1, 5, 6, 2]
l.sort(reverse=True)
l.reverse()
Note .reverse() only reverse the order if there is an order in the first place like timestamp data.

There is also 
sorted(l, reverse=True)
l is just our list variable name. This is not an in place sort. It returns a copy! Remember to update your copy if you have changed or modified the list. 

Machine Learning Workflow

Data cleaning Missing data Outlier Others: duplicates, typos, special characters Strategy for missing data: imputation, mean, median...