python
三笔竹林
程序媛的自我修养
展开
-
pandas groupby 详解
Pandas groupby 函数 使用方法 详解 双索引分组 遍历分组 聚合原创 2017-10-28 17:09:11 · 65820 阅读 · 0 评论 -
Search a 2D matrix II(剑指offer2.3原题)
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted in ascending from left to right.Integers in each col...原创 2018-02-07 12:21:07 · 249 阅读 · 0 评论 -
Leetcode88 MergeSortedArray(剑指Offer2.3.2)
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note:You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold additional ...原创 2017-11-21 16:15:28 · 190 阅读 · 0 评论 -
766. Toeplitz Matrix
A matrix is Toeplitz if every diagonal from top-left to bottom-right has the same element.Now given an M x N matrix, return True if and only if the matrix is Toeplitz. Example 1:Input: m原创 2018-01-29 11:57:49 · 315 阅读 · 1 评论 -
Leetcode Hash Table专题 389. Find the Difference+771. Jewels and Stones+554. Brick Wall
Given two strings s and t which consist of only lowercase letters.String t is generated by random shuffling string s and then add one more letter at a random position.Find the letter that was added ...原创 2018-01-29 12:37:02 · 259 阅读 · 0 评论 -
463 IsLand Perimeter
You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (not diagonally). The grid is completely翻译 2018-01-29 21:40:41 · 166 阅读 · 0 评论 -
Leetcode树专题
树的常识三种遍历方法对应的数据结构Leetcode257.Binary Tree Paths思路:很典型的深度优先搜索配合栈,宽度优先搜索配合队列。学一个遍历二叉树的方法Leetcode111. Minimum Depth of Binary Tree(求二叉树的最短深度)较差的思路:从上题思路套用而来,先求得所有路径的节点数(就是长度),再求最小值较好的思路:宽度优先搜...原创 2018-02-27 15:35:02 · 880 阅读 · 0 评论 -
Leetcode 刷题 Binary Search Easy难度经验总结
[TOC]刷了4道Binary Search Easy难度的题二叉搜索思想好想,难在边界的控制上,于是乎我就在思考能不能背下一个定式,遇到二分搜索的题目就套这个定式。我做的第一道二叉搜索的题目就是一个很好的定式:#744. Find Smallest Letter Greater Than TargetGiven a list of sorted characters letters conta...原创 2017-12-24 11:21:45 · 337 阅读 · 0 评论 -
关于Python语法面试题总结
本篇博文用来记录我对python语法不熟悉的知识点 目录Python中的yield函数生成器简介生成器函数生成器的send检查列表为空的方法如何判断是否为np.nanpandas对多列fillna()pandas如何根据其他两列决定某一列的值Python中的复制快捷键Markdown及扩展表格定义列表代码块numpy读写二进制文件脚注目录数学公式...原创 2018-02-25 17:51:42 · 516 阅读 · 0 评论 -
LeetcodeArray283 MoveZero +LeetcodeArrary26 Remove Duplicates from Sorted Array
这是我在微软面试过程中,真的遇到的面试题,但我没想到,答案竟然如此简单:Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.For example, given nums = [0, 1...原创 2017-11-21 17:11:55 · 183 阅读 · 0 评论 -
Django Demo搭建
写在前面环境配置Django项目说明新建项目时的参数选择项目文件用途说明:search.py 最关键的定义API的地方urls.py 定义路由规则:即在浏览器里输入url调用哪个函数settings.py 整个项目的设置运行服务 python manage.py runserver 0.0.0.0:8000与数据库打交道时需注意的问题判断空的单元格用 is None...原创 2018-03-22 12:42:11 · 1313 阅读 · 0 评论 -
Python 字典操作 总结
字典增team={}#创建字典team['aaa']=1#往字典里添加元素team['bbb']=2team.keys()dict_keys(['aaa', 'bbb'])'aaa' in team.keys()True'la' in team.keys()Falseteam.values()dict_values([1, 2])3 in team.va...原创 2018-04-04 10:38:56 · 1148 阅读 · 0 评论 -
Leetcode图专题
要明白的基础知识node1=UndirectedGraphNode(1)node2=UndirectedGraphNode(2)nodeMap={}nodeMap[node1]="hello"nodeMap[node2]="world"#这样是合法的,打印nodeMap看看nodeMapOut[8]: {<__main__.UndirectedGraphNode at 0x...原创 2018-09-22 21:20:54 · 1802 阅读 · 0 评论 -
Leetcode 动态规划最长公共子序列+ 198HouseRobbingI+II +746Min Cost Climbing Stairs
动态规划解解题思路总结:一个很复杂的问题可以分解成形式类似,模式更小的问题。先尝试解决这个小问题,再扩大到大问题。要从小问题中看出动态规划状态转移式(表达式)。最长公共子串LCSubstringstr1='abcdscde'str2='jaserewcderew'def getNumofCommonSubStr(str1,str2): lenstr1=len(str1)...原创 2018-02-04 14:48:49 · 362 阅读 · 0 评论 -
神奇的数字 202. Happy Number
Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares原创 2018-02-01 18:44:22 · 356 阅读 · 0 评论 -
pandas使用技巧
pandas使用技巧Series dataframe原创 2017-10-23 19:15:01 · 862 阅读 · 0 评论 -
Leetcode刷题 690 Employee Importance
Leetcode刷题 690 Employee Importance原创 2017-10-29 15:22:07 · 1229 阅读 · 0 评论 -
Leetcode 645 FindErrorNum
The set S originally contains numbers from 1 to n. But unfortunately, due to the data error, one of the numbers in the set got duplicated to another number in the set, which results in repetition of原创 2017-10-30 19:37:45 · 414 阅读 · 0 评论 -
python seaborn 共享x轴画图 数据可视化
python seaborn how to share x axis? 数据可视化原创 2017-10-23 18:36:28 · 13595 阅读 · 0 评论 -
从未思考过的问题
1.用python进行数据可视化有什么好处我蹩脚的回答:有很多现成的库可以用,比如seaborn,matplotlib,不用自己再造车轮子了 这样说的缺点:显得我很图省事!天哪!回答的太山炮了吧!回来好好想了想,用python进行数据可视化的好处岂止是这些啊!重,新,说!(1)有seaborn,matplotlib等成熟的开源库可以调用(2)与pandas配合使用,方便原创 2017-11-12 11:00:37 · 299 阅读 · 0 评论 -
Leetcode Array 724 FindPivotIndex
Given an array of integers nums, write a method that returns the "pivot" index of this array.We define the pivot index as the index where the sum of the numbers to the left of the index is equal原创 2017-11-14 15:25:13 · 163 阅读 · 0 评论 -
Ubuntu系统下 fasttext
第一步:安装VMware安装Linux系统(我选的Ubuntu)在pycharm官网下载linux下的安装包 然后按照这个教程安装,运行:http://www.jianshu.com/p/7f16a251f0bb第二步 安装Anaconda:http://www.jianshu.com/p/03d757283339安装完以后如果出现 conda 命令没有发现的情况,原创 2017-11-06 14:05:13 · 1710 阅读 · 0 评论 -
Leetcode665 (Array) Non-decreasing Array +Leetcode674 Longest Continuous Increasing Subsequence
Given an array with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element.We define an array is non-decreasing if array[i] holds for every i (1原创 2017-11-22 19:15:56 · 251 阅读 · 0 评论 -
Leetcode141. Linked List Cycle
Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?这道题的经典之处在于它的思想, "Easier to ask for forgiveness than permission."妈呀人生哲理~翻译 2017-11-23 17:41:17 · 192 阅读 · 0 评论 -
Kaggle Titanic 机器学习实践笔记(二)
Kaggle titanic数据预处理填补空缺值baseline_modellearning_curve原创 2017-12-04 22:04:42 · 683 阅读 · 0 评论 -
67.Add Binary
Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".我的原创解法:62ms,打败了14.46%的python答案我的思路:和十进制加法的套路一样class Solution(object): def原创 2018-01-02 11:31:35 · 255 阅读 · 0 评论 -
118.Pascal's Triangle
118. Pascal's TriangleGiven numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]]原创 2018-01-24 15:48:02 · 182 阅读 · 0 评论 -
数串:给定一传数,组成最大数字
链接:https://www.nowcoder.com/questionTerminal/a6a656249f404eb498d16b2f8eaa2c60来源:牛客网设有n个正整数,将他们连接成一排,组成一个最大的多位整数。如:n=3时,3个整数13,312,343,连成的最大整数为34331213。如:n=4时,4个整数7,13,4,246连接成的最大整数为7424613。输入描述:...原创 2018-09-30 15:47:29 · 690 阅读 · 0 评论