{"pageContext":{"index":13,"total":364,"name":"2019-08-04","items":[{"node":{"frontmatter":{"title":"Amazon Transcribe Streaming现在支持websocket了","publish":true,"cover":"","showCover":true,"date":"2019-08-01","category":"nodejs","url":"https://amazonaws-china.com/cn/blogs/aws/amazon-transcribe-streaming-now-supports-websockets/","author":"Brandon West 摘译 Ka","translator":"","tags":["aws"],"priority":1},"html":"<p>Amazon Transcribe是AWS提供的实时语音解析服务，其内部使用了AI。</p>\n<p>现在Amazon Transcribe支持British English (en-GB 英式英语), US English (en-US美式英语), French (fr-FR法语), Canadian French (fr-CA加拿大式法语), and US Spanish (es-US美式西班牙语).</p>"}},{"node":{"frontmatter":{"title":"Grid Studio与python集成的excel","publish":true,"cover":"","showCover":true,"date":"2019-08-01","category":"python","url":"https://github.com/ricklamers/gridstudio","author":"Rick Lamers","translator":"","tags":["excel"],"priority":1},"html":""}},{"node":{"frontmatter":{"title":"Monorepos - npm7将提供支持","publish":true,"cover":"https://cloud.githubusercontent.com/assets/952783/15271604/6da94f96-1a06-11e6-8b04-dc3171f79a90.png","showCover":true,"date":"2019-08-01","category":"nodejs","url":"https://blog.npmjs.org/post/186494959890/monorepos-and-npm","author":"Daniel Sauble 摘译 Ka","translator":"","tags":["npm"],"priority":1},"html":"<p>Monorepos指的是一个git项目里包含多个子项目的结构。</p>\n<p>目前npm需要通过<a href=\"https://github.com/lerna/lerna\">lerna</a>来提供支持。</p>\n<p>npm7将提供对此种结构的内在支持。</p>"}},{"node":{"frontmatter":{"title":"dotenv-flow依据环境判断的配置加载工具","publish":true,"cover":"https://raw.githubusercontent.com/kerimdzhanov/dotenv-flow/master/dotenv-flow@2x.png","showCover":true,"date":"2019-08-01","category":"nodejs","url":"https://github.com/kerimdzhanov/dotenv-flow","author":"Dan Kerimdzhanov 摘译 Ka","translator":"","tags":["docker"],"priority":1},"html":"<h2 id=\"安装\"><a href=\"#%E5%AE%89%E8%A3%85\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>安装</h2>\n<p><code class=\"language-text\">npm install dotenv-flow --save</code></p>\n<h2 id=\"使用\"><a href=\"#%E4%BD%BF%E7%94%A8\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>使用</h2>\n<div class=\"gatsby-highlight\" data-language=\"javascript\"><pre class=\"language-javascript\"><code class=\"language-javascript\"><span class=\"token function\">require</span><span class=\"token punctuation\">(</span><span class=\"token string\">'dotenv-flow'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">config</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n\nconsole<span class=\"token punctuation\">.</span><span class=\"token function\">log</span><span class=\"token punctuation\">(</span><span class=\"token string\">'database host:'</span><span class=\"token punctuation\">,</span> process<span class=\"token punctuation\">.</span>env<span class=\"token punctuation\">.</span><span class=\"token constant\">DATABASE_HOST</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\nconsole<span class=\"token punctuation\">.</span><span class=\"token function\">log</span><span class=\"token punctuation\">(</span><span class=\"token string\">'database port:'</span><span class=\"token punctuation\">,</span> process<span class=\"token punctuation\">.</span>env<span class=\"token punctuation\">.</span><span class=\"token constant\">DATABASE_PORT</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\nconsole<span class=\"token punctuation\">.</span><span class=\"token function\">log</span><span class=\"token punctuation\">(</span><span class=\"token string\">'database user:'</span><span class=\"token punctuation\">,</span> process<span class=\"token punctuation\">.</span>env<span class=\"token punctuation\">.</span><span class=\"token constant\">DATABASE_USER</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\nconsole<span class=\"token punctuation\">.</span><span class=\"token function\">log</span><span class=\"token punctuation\">(</span><span class=\"token string\">'database pass:'</span><span class=\"token punctuation\">,</span> process<span class=\"token punctuation\">.</span>env<span class=\"token punctuation\">.</span><span class=\"token constant\">DATABASE_PASS</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\nconsole<span class=\"token punctuation\">.</span><span class=\"token function\">log</span><span class=\"token punctuation\">(</span><span class=\"token string\">'database name:'</span><span class=\"token punctuation\">,</span> process<span class=\"token punctuation\">.</span>env<span class=\"token punctuation\">.</span><span class=\"token constant\">DATABASE_NAME</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></code></pre></div>\n<h2 id=\"加载顺序\"><a href=\"#%E5%8A%A0%E8%BD%BD%E9%A1%BA%E5%BA%8F\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>加载顺序</h2>\n<p>👇.env 最先被加载\n️👇.env.local 如果有则加载\n👇NODE<em>ENV 如果指定了NODE</em>ENV且有则加载\n👇NODE<em>ENV.local 如果指定了NODE</em>ENV且有则加载</p>\n<p>上面的顺序是覆盖规则，即后加载的如果有对应的key,则会覆盖，如果没有则不会删除原来的key</p>\n<p>默认，会加载.env.local\n如果指定了NODE<em>ENV环境变量，则会加载.env.${NODE</em>ENV}\n建议的环境名为development, test, production, qa, stage</p>\n<p>可通过DOTENV<em>FLOW</em>PATH指明配置加载地址</p>\n<p>建议.env.production不要放在git上，而是仅放在服务器上。</p>"}},{"node":{"frontmatter":{"title":"marblejs-流处理web框架","publish":true,"cover":"https://raw.githubusercontent.com/marblejs/marble/master/assets/img/logo.png","showCover":true,"date":"2019-07-30","category":"nodejs","url":"https://blog.kazge.com/nodejs/2019/07/29/zh-marblejs-introduction/","author":"Ka","translator":"","tags":["marble"],"priority":2},"html":"<p>marblejs 是 nodejs 的服务端框架，使用 typescript，RxJs。 其作用类似于 expressjs 等。</p>"}},{"node":{"frontmatter":{"title":"docker中使用nodejs的几个技巧","publish":true,"cover":"https://i0.wp.com/blog.docker.com/wp-content/uploads/2019/07/C3-promo-small.jpg?w=1280&ssl=1","showCover":true,"date":"2019-08-01","category":"nodejs","url":"https://blog.docker.com/2019/07/keep-nodejs-rockin-in-docker/","author":"Bret Fisher 摘译 Ka","translator":"","tags":["docker"],"priority":1},"html":"<h2 id=\"镜像选择小的，推荐nodeslim而不是nodealpine\"><a href=\"#%E9%95%9C%E5%83%8F%E9%80%89%E6%8B%A9%E5%B0%8F%E7%9A%84%EF%BC%8C%E6%8E%A8%E8%8D%90nodeslim%E8%80%8C%E4%B8%8D%E6%98%AFnodealpine\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>镜像选择小的，推荐node:slim而不是node:alpine</h2>\n<p><img src=\"https://i0.wp.com/blog.docker.com/wp-content/uploads/2019/07/docker-image-ls-node.png?w=1910&#x26;ssl=1\"></p>\n<h2 id=\"不要修改node_modules文件夹，应该在容器内下载依赖\"><a href=\"#%E4%B8%8D%E8%A6%81%E4%BF%AE%E6%94%B9node_modules%E6%96%87%E4%BB%B6%E5%A4%B9%EF%BC%8C%E5%BA%94%E8%AF%A5%E5%9C%A8%E5%AE%B9%E5%99%A8%E5%86%85%E4%B8%8B%E8%BD%BD%E4%BE%9D%E8%B5%96\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>不要修改node_modules文件夹，应该在容器内下载依赖</h2>\n<h2 id=\"使用node而不是npm启动程序\"><a href=\"#%E4%BD%BF%E7%94%A8node%E8%80%8C%E4%B8%8D%E6%98%AFnpm%E5%90%AF%E5%8A%A8%E7%A8%8B%E5%BA%8F\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>使用node而不是npm启动程序</h2>\n<p>主要原因是npm不能转发进程信号</p>"}},{"node":{"frontmatter":{"title":"react-swipeable - react滑屏组件","publish":true,"cover":"","showCover":true,"date":"2019-08-01","category":"frontend","url":"http://dogfessional.github.io/react-swipeable/","author":"Dogfessional","translator":"","tags":["react"],"priority":1},"html":"<p><a href=\"https://dogfessional.github.io/react-swipeable/\">在线demo</a></p>"}},{"node":{"frontmatter":{"title":"react结合motion和router的动画特效例子","publish":true,"cover":"","showCover":true,"date":"2019-08-01","category":"frontend","url":"https://codesandbox.io/s/framer-motion-x-react-router-n7qhp","author":"Matt Perry","translator":"","tags":["react"],"priority":1},"html":""}},{"node":{"frontmatter":{"title":"semiotic-基于d3的react图表组件","publish":true,"cover":"https://github.com/nteract/semiotic/raw/master/semiotic_logo_horizontal.png","showCover":true,"date":"2019-08-01","category":"frontend","url":"https://github.com/nteract/semiotic","author":"nteract 编辑 Ka","translator":"","tags":["react"],"priority":2},"html":"<p>d3很强大，强大得不是很容易用。semiotic对其进行了封装，成了react组件。</p>\n<p>三种图表结构：</p>\n<ul>\n<li>X,Y结构例如line charts（线图）和 scatterplots（散点图）</li>\n<li>顺序结构例如直方图</li>\n<li>网络结构例如流程图</li>\n</ul>\n<p><a href=\"https://semiotic.nteract.io/\">示例</a></p>"}},{"node":{"frontmatter":{"title":"react打印组件","publish":true,"cover":"","showCover":true,"date":"2019-08-01","category":"frontend","url":"https://github.com/gregnb/react-to-print","author":"gregn","translator":"","tags":["react"],"priority":1},"html":"<div class=\"gatsby-highlight\" data-language=\"javascript\"><pre class=\"language-javascript\"><code class=\"language-javascript\"><span class=\"token keyword\">const</span> <span class=\"token function-variable function\">Example</span> <span class=\"token operator\">=</span> <span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">{</span>\n  <span class=\"token keyword\">const</span> componentRef <span class=\"token operator\">=</span> <span class=\"token function\">useRef</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n  <span class=\"token keyword\">return</span> <span class=\"token punctuation\">(</span>\n    <span class=\"token operator\">&lt;</span>div<span class=\"token operator\">></span>\n      <span class=\"token operator\">&lt;</span>ReactToPrint\n        trigger<span class=\"token operator\">=</span><span class=\"token punctuation\">{</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token operator\">&lt;</span>button<span class=\"token operator\">></span>Print <span class=\"token keyword\">this</span> out<span class=\"token operator\">!</span><span class=\"token operator\">&lt;</span><span class=\"token operator\">/</span>button<span class=\"token operator\">></span><span class=\"token punctuation\">}</span>\n        content<span class=\"token operator\">=</span><span class=\"token punctuation\">{</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> componentRef<span class=\"token punctuation\">.</span>current<span class=\"token punctuation\">}</span>\n      <span class=\"token operator\">/</span><span class=\"token operator\">></span>\n      <span class=\"token operator\">&lt;</span>ComponentToPrint ref<span class=\"token operator\">=</span><span class=\"token punctuation\">{</span>componentRef<span class=\"token punctuation\">}</span> <span class=\"token operator\">/</span><span class=\"token operator\">></span>\n    <span class=\"token operator\">&lt;</span><span class=\"token operator\">/</span>div<span class=\"token operator\">></span>\n  <span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span><span class=\"token punctuation\">;</span></code></pre></div>"}},{"node":{"frontmatter":{"title":"你为什么绝对应该学习用CSS-in-JS","publish":true,"cover":"","showCover":true,"date":"2019-08-01","category":"frontend","url":"https://jxnblk.com/blog/why-you-should-learn-css-in-js/","author":"Brent Jackson 摘译 Ka","translator":"","tags":["css"],"priority":1},"html":"<h2 id=\"css-in-js-做了什么\"><a href=\"#css-in-js-%E5%81%9A%E4%BA%86%E4%BB%80%E4%B9%88\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>CSS-in-JS 做了什么</h2>\n<ul>\n<li>\n<p>使用javascript语法写样式</p>\n</li>\n<li>\n<p>使用组件来编排样式</p>\n</li>\n<li>\n<p>利用javascript的语法特性</p>\n</li>\n<li>\n<p>利用javascript生态系统</p>\n</li>\n</ul>\n<h2 id=\"css-in-js-做了什么抽象\"><a href=\"#css-in-js-%E5%81%9A%E4%BA%86%E4%BB%80%E4%B9%88%E6%8A%BD%E8%B1%A1\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>CSS-in-JS 做了什么抽象</h2>\n<ul>\n<li>不需要关心级联(cascade)</li>\n<li>不需要关心权重(Specificity)</li>\n<li>不需要关心命名选择器(Naming selectors)</li>\n<li>不需要关心强制命名转换(Enforcing naming conventions)</li>\n<li>不需要关心关联其他语言(Linting another language)</li>\n<li>不需要关心特定的文件结构（Enforcing file structures for another language）</li>\n<li>不需要关心附加的构建工具(Additional build tools)\n总之，只需要js就够了。</li>\n</ul>\n<h2 id=\"从哪里开始\"><a href=\"#%E4%BB%8E%E5%93%AA%E9%87%8C%E5%BC%80%E5%A7%8B\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>从哪里开始</h2>\n<p>阅读 <a href=\"https://www.gatsbyjs.org/docs/css-in-js/\">https://www.gatsbyjs.org/docs/css-in-js/</a>\n使用 <a href=\"https://www.gatsbyjs.org/docs/emotion/\">Emotion</a> 和 <a href=\"https://www.gatsbyjs.org/docs/styled-components/\">Styled-Components</a></p>"}},{"node":{"frontmatter":{"title":"动画工具箱大集合","publish":true,"cover":"","showCover":true,"date":"2019-08-01","category":"frontend","url":"https://css-tricks.com/css-animation-libraries/","author":"Chris Coyier ","translator":"","tags":["css"],"priority":1},"html":""}},{"node":{"frontmatter":{"title":"不要在生产环境中启动程序时整合数据库","publish":true,"cover":"","showCover":true,"date":"2019-07-29","category":"devops","url":"https://pythonspeed.com/articles/schema-migrations-server-startup/","author":"Itamar Turner-Trauring 摘译 Ka","translator":"","tags":["database"],"priority":1},"html":"<ul>\n<li>生产环境，往往有多个服务器，如果同时发布，容易造成同时整合数据库造成问题。</li>\n<li>依赖发布程序来整合数据库，也就依赖程序会有downtime。</li>\n</ul>\n<p>解决：\n数据库整合应该是单独的操作，这样可以通过策略来避免downtime。\n可使用<a href=\"https://github.com/flyway/flyway\">flyway</a>这样的开源工具来自动整合。</p>"}},{"node":{"frontmatter":{"title":"使用panda读取json","publish":true,"cover":"https://www.marsja.se/wp-content/uploads/2019/07/python_pandas_read_json_write_url_requests.jpg","showCover":true,"date":"2019-08-01","category":"python","url":"https://www.marsja.se/how-to-read-and-write-json-files-using-python-and-pandas/","author":" Erik Marsja 编辑 Ka","translator":"","tags":["panda"],"priority":2},"html":"<h2 id=\"不使用panda\"><a href=\"#%E4%B8%8D%E4%BD%BF%E7%94%A8panda\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>不使用panda</h2>\n<div class=\"gatsby-highlight\" data-language=\"python\"><pre class=\"language-python\"><code class=\"language-python\"><span class=\"token keyword\">import</span> json\n<span class=\"token keyword\">with</span> <span class=\"token builtin\">open</span><span class=\"token punctuation\">(</span><span class=\"token string\">'data.json'</span><span class=\"token punctuation\">,</span> <span class=\"token string\">'w'</span><span class=\"token punctuation\">)</span> <span class=\"token keyword\">as</span> outfile<span class=\"token punctuation\">:</span>\n    json<span class=\"token punctuation\">.</span>dump<span class=\"token punctuation\">(</span>data<span class=\"token punctuation\">,</span> outfile<span class=\"token punctuation\">)</span></code></pre></div>\n<h2 id=\"panda读取文件\"><a href=\"#panda%E8%AF%BB%E5%8F%96%E6%96%87%E4%BB%B6\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>panda读取文件</h2>\n<div class=\"gatsby-highlight\" data-language=\"python\"><pre class=\"language-python\"><code class=\"language-python\"><span class=\"token keyword\">import</span> pandas <span class=\"token keyword\">as</span> pd\n\ndf <span class=\"token operator\">=</span> pd<span class=\"token punctuation\">.</span>read_json<span class=\"token punctuation\">(</span><span class=\"token string\">'data.json'</span><span class=\"token punctuation\">)</span>\n\ndf</code></pre></div>\n<h2 id=\"json-to-csv\"><a href=\"#json-to-csv\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>json to csv</h2>\n<div class=\"gatsby-highlight\" data-language=\"python\"><pre class=\"language-python\"><code class=\"language-python\">df<span class=\"token punctuation\">.</span>to_csv<span class=\"token punctuation\">(</span><span class=\"token string\">\"data.csv\"</span><span class=\"token punctuation\">)</span></code></pre></div>\n<h2 id=\"直接网络获取\"><a href=\"#%E7%9B%B4%E6%8E%A5%E7%BD%91%E7%BB%9C%E8%8E%B7%E5%8F%96\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>直接网络获取</h2>\n<div class=\"gatsby-highlight\" data-language=\"python\"><pre class=\"language-python\"><code class=\"language-python\"><span class=\"token comment\"># 方法一</span>\nurl <span class=\"token operator\">=</span> <span class=\"token string\">\"https://api.exchangerate-api.com/v4/latest/USD\"</span>\ndf <span class=\"token operator\">=</span> pd<span class=\"token punctuation\">.</span>read_json<span class=\"token punctuation\">(</span>url<span class=\"token punctuation\">)</span>\ndf<span class=\"token punctuation\">.</span>head<span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span>\n\n<span class=\"token comment\"># 方法二</span>\n<span class=\"token keyword\">import</span> requests\n<span class=\"token keyword\">from</span> pandas<span class=\"token punctuation\">.</span>io<span class=\"token punctuation\">.</span>json <span class=\"token keyword\">import</span> json_normalize\n\nurl <span class=\"token operator\">=</span> <span class=\"token string\">\"https://think.cs.vt.edu/corgis/json/airlines/airlines.json\"</span>\nresp <span class=\"token operator\">=</span> requests<span class=\"token punctuation\">.</span>get<span class=\"token punctuation\">(</span>url<span class=\"token operator\">=</span>url<span class=\"token punctuation\">)</span>\n\ndf <span class=\"token operator\">=</span> json_normalize<span class=\"token punctuation\">(</span>resp<span class=\"token punctuation\">.</span>json<span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span>\ndf<span class=\"token punctuation\">.</span>head<span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span></code></pre></div>"}},{"node":{"frontmatter":{"title":"在线工具-生成使用styled组件创建的React条纹字特效组件","publish":true,"cover":"","showCover":true,"date":"2019-08-01","category":"frontend","url":"https://components.ai/text-stripes/#reacttt","author":"Components.ai","translator":"","tags":["react"],"priority":1},"html":""}},{"node":{"frontmatter":{"title":"动画表示React生命周期","publish":true,"cover":"","showCover":true,"date":"2019-08-01","category":"frontend","url":"https://medium.com/@js_tut/react-animated-tutorial-7a46fa3c2b96","author":"JavaScript Teacher","translator":"","tags":["react"],"priority":1},"html":""}},{"node":{"frontmatter":{"title":"semiotic-基于d3的react图表组件","publish":true,"cover":"https://camo.githubusercontent.com/a6caff29efcb54c8be6243fa952397c1a0ad0478/68747470733a2f2f6c68342e676f6f676c6575736572636f6e74656e742e636f6d2f2d5056772d5a554d397656382f557557654835316f7330492f414141414141414144364d2f30496b673776694a6674512f77313238362d683536362d6e6f2f6861636b6174686f6e2d737461727465722d6c6f676f2e6a7067","showCover":true,"date":"2019-08-01","category":"nodejs","url":"https://github.com/sahat/hackathon-starter","author":"Sahat Yalkabov 编辑 Ka","translator":"","tags":["boilerplate"],"priority":1},"html":"<ul>\n<li>Express + mongodb + pug（express模板引擎）</li>\n<li>需要下载项目模板</li>\n<li>\n<p>集成了多个api 服务</p>\n<blockquote>\n<p>老编想说：既然都mongodb了，为什么不Meteor?</p>\n</blockquote>\n</li>\n</ul>"}},{"node":{"frontmatter":{"title":"游戏-飞翔的鸡蛋(Aero Egg)-ios非中国区可下载","publish":true,"cover":"https://blog.kazge.com/assets/volitantegg-show.gif","showCover":true,"date":"2019-06-12","category":"game","url":"https://apps.apple.com/us/app/aero-egg/id1247264387?ls=1","author":"广告","translator":"","tags":["ads"],"priority":1},"html":""}},{"node":{"frontmatter":{"title":"流体模拟特效","publish":true,"cover":"","showCover":true,"date":"2019-08-01","category":"frontend","url":"https://liquid.lab.lorenzocadamuro.com/","author":"Lorenzo Cadamuro 编辑 Ka","translator":"","tags":["webgl"],"priority":1},"html":"<p>⚠️ 运行 CPU 会狂转!</p>\n<p>使用<a href=\"https://google.github.io/liquidfun/\">liquidfun(基于 box2d 的刚体引擎)</a>和<a href=\"https://frontendfoc.us/link/67600/rss\">regl WebGL library</a></p>\n<iframe style=\"width:100%;height:160px;border:none;\" src=\"https://liquid.lab.lorenzocadamuro.com/\"></iframe>"}},{"node":{"frontmatter":{"title":"渐变样式选择工具","publish":true,"cover":"","showCover":true,"date":"2019-08-01","category":"frontend","url":"https://www.gradientmagic.com/","author":"Jordan Marshall","translator":"","tags":["css"],"priority":1},"html":""}},{"node":{"frontmatter":{"title":"想让你的文章出现在这里？","publish":true,"cover":"","showCover":true,"date":"2019-07-08","category":"frontend","url":"mailto:editor@zhouexin.com?subject=投稿!","author":"投稿","translator":"","tags":["editor"],"priority":1},"html":""}},{"node":{"frontmatter":{"title":"纯css响应式iframe","publish":true,"cover":"","showCover":true,"date":"2019-08-01","category":"frontend","url":"https://css-tricks.com/responsive-iframes/","author":"Chris Coyier","translator":"","tags":["css"],"priority":1},"html":"<p>iframe父元素relative,css创建一个伪元素，大小是指定的，再将iframe高宽设置为100%。</p>\n<p>代码:</p>\n<iframe height=\"265\" style=\"width: 100%;\" scrolling=\"no\" title=\"Responsive Iframe\" src=\"//codepen.io/chriscoyier/embed/RXPjWp/?height=265&theme-id=0&default-tab=css,result\" frameborder=\"no\" allowtransparency=\"true\" allowfullscreen=\"true\">\n  See the Pen <a href='https://codepen.io/chriscoyier/pen/RXPjWp/'>Responsive Iframe</a> by Chris Coyier \n  (<a href='https://codepen.io/chriscoyier'>@chriscoyier</a>) on <a href='https://codepen.io'>CodePen</a>.\n</iframe>"}}]}}