python |
Pythonタグが付けられた新着投稿 - Qiita |
スクレイピングで不動産情報取得(SUUMO)(2) |
https://qiita.com/kyokohama66/items/95ace9130c1f81d306a8
|
①取得したデータを表形式にする②表形式の取得結果をCSVに出力する①については、インポートしたPandasを使って、スクレイピング結果が入っているリストをデータフレームに変換する必要があります。 |
2021-04-25 05:42:38 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
スクレイピングで不動産情報取得(SUUMO)(1) |
https://qiita.com/kyokohama66/items/30aaacec0bb5c8bd7993
|
変数feeとmanagementfeeに賃料と管理費格納するfeemanagementfeepricefindallli変数depositとgratuityに、敷金と礼金を格納するdepositgratuityfirstfeefindallli変数madoriとmensekiに間取りと面積を格納するmadorimensekicapacityfindallli解析した結果を辞書型として格納する。 |
2021-04-25 05:39:24 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
Python: dict型の操作まとめ |
https://qiita.com/sou37/items/e4ba99b152a1b3f697d9
|
valueの値でソートする場合は以下のようにする。 |
2021-04-25 05:35:12 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
タイタニック号の 生存者予測 |
https://qiita.com/kyokohama66/items/8c7141b7b92f56812fba
|
dfSexpdgetdummiesdfSexdropfirstTruedfhead学習用データとテストデータに分割する機械学習を使って生存するか否かを予測するには、「学習で使うデータ」と「生存するか否かを当てたい乗客データ」に分割しておく必要があります。 |
2021-04-25 05:33:00 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
お天気アプリ |
https://qiita.com/kyokohama66/items/5e07f1b47be141c7bb08
|
お天気アプリPython学習の一環として、Tkinterを使って天気アプリ作成しました。 |
2021-04-25 05:27:20 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
DANetとmusic2vecによるノイズ除去と音楽ジャンル分類 |
https://qiita.com/KMASAHIRO/items/85023b7a999aa46751c6
|
まず環境音をノイズとして音楽に混ぜてそれらを分離するようにDANetを学習させ、事前に音楽ジャンル分類を学習させていたmusicvecにDANetの出力を入力して音楽ジャンルの分類を行いました。 |
2021-04-25 05:02:03 |
海外TECH |
DEV Community |
Quick start with Tailwind CSS |
https://dev.to/thecoderishi/quick-start-with-tailwind-css-334n
|
Quick start with Tailwind CSS Configuring Tailwind CSS without using PostCSS plugin Make a folder with any name and open the folder path in terminal You can use VS Code built in terminal Create package json filenpm init y default optionsInstall tailwind CSS using npmnpm i tailwindcssInstall Autoprefixernpm i autoprefixer For different browsers supportCreate a folder name public inside public folder create a file named index html and create another folder named src inside src folder create a file named tailwind css Your file structure should looks like this├ーtailwindcss│├ーpublic││├ーindex html│├ーsrc││├ーtailwind css Open src tailwind css and copy paste below code tailwind base tailwind components Write Custom CSS tailwind utilities Create a build scrip which compile the src tailwind css and make actual compiled css inside public folder open package json file and copy paste below code scripts build tailwindcss build src tailwind css o public tailwind css Run build scriptnpm run build This will generate compiled css inside public folder and link this css in your index html Note Don t modify compiled css Customize tailwind CSS ConfigFirst create tailwind config file with following commandnpx tailwindcss init It will generate tailwind config jsIn talwind config js you can define your own custom property after changing talwind config js again you need to run build scriptnpm run build Compress size of tailwind css Production ready Install NODE ENVnpm install win node envIn package json file add the following script which reduce the compiled css It will remove unused classes prod NODE ENV production npx tailwindcss build src tailwind css o public tailwind css“Open tailwind config js file add the following line in purg purge public html Now you can make production ready css run the following commangnpm run prod Configuring Tailwind CSS without as PostCSS pluginCreate package json filenpm init y default optionsInstall tailwind CSS using npmnpm i tailwindcssInstall Autoprefixernpm i autoprefixer For different browsers supportInstall PostCSS CLI Pluginnpm i postcss cli Create a folder name public inside public folder create a file named index html and create another folder named src inside src folder create a file named tailwind css Your file structure should looks like this├ーtailwindcss│├ーpublic││├ーindex html│├ーsrc││├ーtailwind css Open src tailwind css and copy paste below code tailwind base tailwind components Write Custom CSS tailwind utilities Create a build scrip which compile the src tailwind css and make actual compiled css inside public folder open package json file and copy paste below code scripts build postcss build src tailwind css o public tailwind css Run build scriptnpm run build This will generate compiled css inside public folder and link this css in your index html Note Don t modify compiled css Customize tailwind CSS ConfigFirst create tailwind config file with following commandnpx tailwindcss init It will generate tailwind config jsIn talwind config js you can define your own custom property after changing talwind config js again you need to run build scriptnpm run build Compress size of tailwind css Production ready Install NODE ENVnpm install win node envIn package json file add the following script which reduce the compiled css It will remove unused classes prod NODE ENV production npx tailwindcss build src tailwind css o public tailwind css“Open tailwind config js file add the following line in purg purge public html Now you can make production ready css run the following commangnpm run prod |
2021-04-24 20:37:24 |
海外TECH |
DEV Community |
👨🔬 Why The DOM Causes Negative Enthalpy! - Learning Frontend Deeply - Part 2 |
https://dev.to/alimobasheri/why-the-dom-causes-negative-enthalpy-learning-frontend-deeply-part-2-1k8n
|
Why The DOM Causes Negative Enthalpy Learning Frontend Deeply Part Why Should You Care About The DOM And The Negative Enthalpy In the first part of this series we learned that HTML is a Markup Language destined to create documents We now know that this document is much like a paper one We can use different elements and layout systems in HTML to shape our ideal document layout But still there s a question If it s only about documents then humans have been able to create them thousands of years ago Documents can be carved on stone painted on papyruses and written on paper So while HTTP facilitates the document s sharing around the world there s one important thing that a webpage needs to be capable of to ultimately become superior to a simple document And it is the ability to update data in real time in response to user interactions and different events This feature makes documents interactive and pushes the limit of the traditional documents which could never be edited or updated And especially this is one of the main skills every frontend developer should acquire Throughout this article we are going to learn about the Document Object Model abbreviated as the DOM In the last part we learned about the Document now we ll try to figure out what an Object is and how the DOM implements the Model But we re not going down a straightforward path We re going to learn about some basic theories of computer programming This includes variables objects collections compilers and etc This is because I want to show you how in the end all of these theories shape the internal functionalities of a web frontend application This is somewhat like how we re introduced to Christopher Nolan s Tenet It s going to show you some theories and in the end you are going to face it all in real action Then let s dive deeper First questions first ️What Is An Object While a motorcycle has two wheels a car holds four Both are objects Each with its traits These traits could vary in numerous ways The comparison we made identifies the difference in the count of common property in two distinct objects A contrasting case is the observation of a hen and a motorcycle Both can move And while the hen utilizes its legs for this purpose the other uses its wheels The movement action is possible for both of them but they do so using quite different tools In terms of programming we can express the actions as Methods and the tools as Properties Thus the main element in Object Definition is that a set of traits shape the object By knowing what an object definition is let s move on to how a document is defined by it What is an object model C is a programming language So is C Both are known as semi low level languages This means you ll need to write thousands of lines of code to make a simple program work But in exchange their programs run at higher speeds Because by writing code in a low level language the system needs less translation of your code to understand what you re trying to assemble But there is a major difference between the two languages we talked about earlier C is an object oriented version of C What does this mean This means that we can define objects in C programs which possess their own traits and actions Let s define object orientation in smaller chunks That ll make it easier for you to grasp the idea if you don t already know about it First let s begin with a simple thing Value That s what every program is about ️⃣Hey PC Take This In a program every value is stored in a part of the memory This value is identified by a reference A reference is a specific number that addresses a location in the memory that holds a specific value This referencing can be suitable for performing actions like computing For example if you want to calculate the sum of and you have to store these values in the system and then give the system the program by which it should add these two numbers A reference to the value could be a number like and a reference to the value could be another number like The system can manage these references easily But it would be hard for a human to work with them We ll easily forget which reference points to which value Call My Ey A variable is simply a name we give the reference to a value In the last paragraph we said that in an exemplary system a reference to number is Now what if we told the system that we want this reference to be called a so that every time we had to point to this number we simply give its name and the system retrieves the value for us How variables resemble humans memory Click to learn more This behavior is close to how we humans store different data in our minds For example when we want to refer to a long fruit with a yellow cover we say banana The value was retrieved ️Hey PC Repeat After Me Ey equals Fortunately most of the programming languages manage this for us Here s how we define a variable in JavaScript var a var b In the above code block we ve declared two values stored them in memory and given them a custom name for their references Thus if we wanted to add these numbers we simply tell the system add a and b In JavaScript it s written like this var c a b What happened in this code block click to learn more Here in a single line we ve performed three actions First we ve retrieved the two values and from the memory by calling their names Then we ve added these two numbers which result in a new value Next the new value is stored in the memory and its reference is given a name c Well we gave the references a name But what does it have to do with Object Orientation ️The Thing or The Object So far we ve only defined simple variables These may be the basics of programming but they are insufficient for a more advanced program Metal is one of the most useful materials in construction but by giving a fair look at the world around you it s easy to conclude that buildings aren t just made of metals They re assembled of glasses metals concrete etc The same observance applies to a program It s never made of single values But rather a collection of them Person Person Person You know people by their names phone numbers looks jobs and much more Perhaps you know a lot of people Hundreds of names could be familiar to you Indeed you have got a collection of information in your memory A collection of names or a collection of different brands All in all collections are the main way of information storage What makes collections suitable for this purpose is their flexibility and simplicity in integration You can easily search sort filter or manipulate a collection Data StructuresProbably algorithms are familiar to you If not you can think of the following text as an algorithm Go to the kitchen Search the cabinets for the red pepper can If found swallow the whole can s content If not go to the freezer Take out all the ices in it and swallow them one by one As you can see an algorithm is a set of step to step commands Computer programs are instructed using these algorithms Let s think about the sum program which we previously wrote using the variables Its algorithm is straightforward Take the first number and add it to the second one Store the result in a new memory location But is there a collection too ArraysSometimes you need to store different values as a group Like a list of different versions of a sentence You can store each value in a separate variable but that s not the ideal way Because for instance if you are required to iterate over the list and find a specific version you ll have to check each value manually to find out whether it s the wanted value or not Arrays come to help An array is indeed a list of memory addresses Of course these memory addresses refer to values But its difference with a normal reference is that it can be indexed What is indexing And how does an array work click to learn more Simply it s like when you are looking at a list of different versions of a sentence and you ask your colleague about which version he likes the most and he responds The third one So the keyword here is third Now if we wanted to represent the version history list in a JavaScript array it would look like this var versions A sentence Beautifully written sentence Da Funny Sendenze To access the second sentence and store it in a new variable the following line of JavaScript suffices var theDesiredSentence versions In JavaScript arrays are indexed from which means that the first element s index is and the nth element s index is n The array is a very simple collection But remember when we talked about the calculation program It didn t consist of any arrays Perhaps we could use an array of numbers and write a program to calculate the sum of all of the numbers in the array But that s not what we re trying to do right now The question was whether in that simple program a collection existed or not Now none of the values were collections but in reality the whole program is a collection Why is that Program CompilationEvery program written in a language has to be compiled into machine language to act as fast as possible The machine language is the most direct one but having the lowest level among the programming languages it s not possible for programmers to easily interact with it The nerds solution to this problem has been the development of higher level programming languages Yes even C has a higher level in comparison to that of Assembly Still there s a matter to reflect upon If communication with machines is difficult then how comes the compilers do it and turn huge chunks of code into machine readable ones To understand the mechanism you can think of yourself trying to speak a foreign language how will you manage it First you will create mental models What is the mental model It s the concept or the meaning of what you are trying to translate How is a mental model designed Suppose you want to tell a foreigner that his face is burning What is the concept behind this sentence A face that belongs to that person is melting due to contact with heat But what is the context Perhaps you and the other person are trapped inside a burning house and you are screaming at him to warn him that his face is burning Or maybe you are pushing his face into boiling water and joyously shouting Ha Ha Ha Your face is burning Do you see Different contexts Different tones Different sentence structures Now how are these related to a compiler s task Well first of all it gathers every value in your program These values are like the meanings of every single word Next it tries to shape a model of your values This model is shaped from the different scopes inside a program code Scopes are different blocks of code inside a program These blocks contain standalone logics which can perform independently of other parts of the code Sure most of the time the blocks will use variables defined in other scopes or passed as arguments The compiler will look for the various blocks present in a code to shape its model These blocks will help in maintaining the levels of the model Previously we learned about arrays which are the most common forms of collections but the ones we spoke about were only one dimensional However in cases in which we need to specify a collection of groups of values we can simply nest arrays inside each other In JavaScript a nested array might look like this var nestedArray In the above code example the nestedArray variable could be a model of various values organized in different blocks Like block and block and so on This way the compiler will know what block each value belongs to So if somewhere in your code you try to call a value that isn t available in the corresponding block the compiler will throw an error A nested array might be a good example to illustrate a collection model but not perfect for such a case as a compiler s model Because arrays are just a group of values in a specific order Thus the programmers have designed various types of data structures that can be used to implement collections in a useful way Examples of these data structures include linked lists queues stacks graphs and hash tables What Data Structure Does A Compiler Use Compilers mainly use Symbol Tables as their primary data structure A Symbol Table is a symbolized collection of data Don t panic if this doesn t make sense to you we re going to learn it in more detail ️What does symbolized mean Remember when we talked about variables We stored a value in the memory and then gave it a name So each variable in a program is made of a group of information that includes memory reference name type and attribute Using these properties the compiler can store what information it requires about a particular variable in a single symbol and then implement these symbols into a bigger model which represents the code blocks and scopes using a data structure A representation of Symbol Tables could look like this lt symbol name type attribute gt What are the type and the attribute click to learn more JavaScript is a dynamically typed language which means that you don t have to strictly define a variable s type But under the hood each value owns a type There are several built in types like objects strings numbers etc These types declare the intrinsic behavior of the variables So in a Symbol Table each value holds a type declaration The attribute is another unpopular term in JS In languages like Java keywords such as public and private exist that can be used in a variable declaration to indicate in what context the variable can be used The let and const are the two attributes that can be used in JS For instance using the const attribute clarifies for the compiler that the variable can t be assigned a new value after its initial declaration What data structure a compiler uses for shaping the code blocks can vary between Linear Lists Binary Search Tree and Hash Tables based on the compiler s architect Is a data structure enough for a compiler to get its job done The short answer is no The long answer is that a data structure is only a model that makes data available to you It exposes no methods to work with the data It s barely a skeleton of data A skeleton doesn t move by itself It can take no action A body needs muscles to be able to handle its skeleton for good use Hence the compiler uses its own built in methods to work with the data that is exposed to it through the symbols How is this data structure is similar to a database click to learn more Each symbol is an entry and each code block is called a block You could think of a symbol table as a database Indeed I can relate to this personally since I m currently working on the development of a web based database management application for the place I work at Each cell in a database table is like an entry A cell can be a text a number a date and many more fields Each of these fields has its own type and attributes Each table can also be divided into different phases with each phase having its own rows of entries But a database management application isn t made up of just entries and phases It s also about the ordering of data its aggregation editing inserting removing validating and etc Each of these functionalities can also be generalized to how a compiler commonly behaves with a symbol table ️What now This was a long read but not a useless one We have learned about the program s compilation progress and we ve come to acknowledge what a data structure is and how an object is defined Now it s time to get back on track and learn how a Document s Object Model is implemented But first let s take a few seconds and think about the answer to a fundamental question of the frontend area ️Is HTML a Data Structure or is it an Object It s tempting to say that HTML is an object since it possesses traits like a body or a head or a title These may sound like traits being defined for an object But they re not and HTML is definitely not an Object It s a Data Structure All that HTML does is expose data Indeed you the developer who writes the HTML are exposing this data to the browser Using the document structure which we talked about in the last part you were doing the compiler s job Oh yes Perhaps you have written several HTML documents or maybe you re an experienced one and using the HTML markup has been a daily job for you But you have never thought that you were indeed writing a pre compile file That you were doing the programming process with a negative enthalpy Sounds crazy and sounds like what Christopher Nolan introduced in his movie Tenet You have come a long way to reach this point and perhaps you are tired or you think this article will be useless Yeah I know This idea is turning around your head that I ve been mocking you all the time That compilers and data structures and the Object Orientation have got nothing to do with a simple HTML But be patient my dear reader From now things only get better After all what do you expect from a Nolanish idea SPOILER FREE I m not going to spoil anything from the movie s plot The negative enthalpy theory is something you learn very early in the movie So enjoy the article But how is the negative enthalpy happening A chemical reaction with a negative enthalpy is one that loses energy throughout the process This might sound too theoric but we can interpret it in our subject as such When we code a program and the compiler turns it into an executable file we re keeping energy by doing less work by ourselves The compiler is the one that handles the hassle of translating our code to machine readable programs Now when we write HTML we re losing energy Because we re doing a part of the compiler s job which is creating a data structure We re doing more job to model the fine Document Structure for our purpose But the Data Structure isn t the only thing that the compiler creates There was actually a need for different methods to be able to work with this data This is where the Document Object Model comes into play And to no surprise this time we re going to work with objects ️Where are my methods So you give the browser all the data necessary in your document organized into nested structures according to your desired layout and expect the magic to happen But that s not what every application is about Is it Nowadays web applications are more than just scientific documents They re about Interactive Interfaces which respond to user interaction Documents get updated changed inspected animated styled and manipulated in real time If you think of the HTML Document as the Symbol Table then by using the DOM Methods to work with this data structure and to change it you are doing the compiler s job Because you are managing the available data structures and methods to output your desired program But there is one important difference The compiler compiles once you do it many times What Next Originally this post was intended to have full coverage of all the methods that the DOM avails us with But tonight I decided that writing such a long article might not be a wise move and might result in the dear readers attention loss So our long journey comes to a pause with the knowledge that the management of a frontend application is like a real time compilation In the next part we ll learn about the DOM s methods and compare each of them with what a compiler does The next part is more like an action ride through how updating a document s different parts results in different states and perhaps Tenets And I expect the next part to be released faster than this one Since most of it is already written The End And don t forget to give me feedback I m trying to bring new ideas into this series and like everyone else my ideas have their own flaws too So I would be glad to hear what you think |
2021-04-24 20:23:11 |
海外TECH |
Engadget |
Elon Musk will host 'Saturday Night Live' on May 8th |
https://www.engadget.com/elon-musk-to-host-saturday-night-live-202950558.html
|
episode |
2021-04-24 20:29:50 |
海外TECH |
Engadget |
The Pentagon gave a company control of 175 million IP addresses |
https://www.engadget.com/pentagon-gives-ip-address-control-to-florida-company-200249879.html
|
security |
2021-04-24 20:02:49 |
海外科学 |
NYT > Science |
U.S. Is Under Pressure to Release Vaccine Supplies as India Faces Deadly Surge |
https://www.nytimes.com/2021/04/24/climate/inda-covid-vaccines.html
|
indian |
2021-04-24 20:23:39 |
ニュース |
BBC News - Home |
Biden says Armenian mass killing was genocide |
https://www.bbc.co.uk/news/world-us-canada-56874811
|
immediate |
2021-04-24 20:39:18 |
ニュース |
BBC News - Home |
Slieve Donard: Over 100 firefighters continue to tackle Mournes 'major incident' |
https://www.bbc.co.uk/news/uk-northern-ireland-56870380
|
mourne |
2021-04-24 20:03:54 |
ニュース |
BBC News - Home |
West Ham United 0-1 Chelsea: Timo Werner earns Blues key win in race for top four |
https://www.bbc.co.uk/sport/football/56782077
|
West Ham United Chelsea Timo Werner earns Blues key win in race for top fourChelsea take a huge step towards securing a Champions League spot as Timo Werner s first goal since February helps Thomas Tuchel s side beat top four rivals West Ham |
2021-04-24 20:23:32 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
大幸薬品のクレベリンが爆売れで大正製薬のパブロンは激減、製薬「新格差」の実態 - 戦慄のK字決算 |
https://diamond.jp/articles/-/268494
|
売り上げ |
2021-04-25 05:25:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
三菱地所が独り勝ちに?不動産業界で天地逆転、収益の柱「オフィス」転落の衝撃 - 戦慄のK字決算 |
https://diamond.jp/articles/-/268493
|
三菱地所 |
2021-04-25 05:20:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
梶山弘志経産相が断言、グリーン成長基金は「2兆円で足りなければ積み増す!」 - 1100兆円の水素バブル |
https://diamond.jp/articles/-/268316
|
梶山弘志 |
2021-04-25 05:15:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
村田製作所、TDKが四半期増収率10%超!急成長のカギとなった「ある業界」とは? - ダイヤモンド 決算報 |
https://diamond.jp/articles/-/269435
|
上場企業 |
2021-04-25 05:10:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
51歳・4人家族で貯金3000万の男性、今すぐ退職しても家計は大丈夫? - お金持ちになれる人、貧乏になる人の家計簿 深野康彦 |
https://diamond.jp/articles/-/269304
|
不労所得 |
2021-04-25 05:05:00 |
北海道 |
北海道新聞 |
エンゼルス大谷、次回先発27日 敵地でのレンジャーズ戦 |
https://www.hokkaido-np.co.jp/article/537129/
|
大リーグ |
2021-04-25 05:12:00 |
北海道 |
北海道新聞 |
道のコロナ対策 「まん延防止」で十分か |
https://www.hokkaido-np.co.jp/article/537091/
|
新型コロナウイルス |
2021-04-25 05:05:00 |
ビジネス |
東洋経済オンライン |
年収激減の「役職定年」乗り切るための心得 「人生の終わり」ではなく「通過点」とするために | 家計・貯金 | 東洋経済オンライン |
https://toyokeizai.net/articles/-/424126?utm_source=rss&utm_medium=http&utm_campaign=link_back
|
東洋経済オンライン |
2021-04-25 05:40:00 |
コメント
コメントを投稿