IT |
気になる、記になる… |
「新しいBing」、1回のチャットのターン数制限が8回までに緩和 ー ターン数が分かるカウンター機能も追加 |
https://taisy0.com/2023/03/06/169286.html
|
microsoft |
2023-03-05 22:55:54 |
IT |
気になる、記になる… |
Apple、「Apple Watch」のチャレンジ企画「国際女性デーチャレンジ」を正式発表 ー 3月8日に開催へ |
https://taisy0.com/2023/03/06/169283.html
|
apple |
2023-03-05 22:42:12 |
IT |
ビジネス+IT 最新ニュース |
世界CEO調査でわかった、お客さまより従業員重視、グローバル化終焉、インフレ対応 |
https://www.sbbit.jp/article/cont1/108692?ref=rss
|
|
2023-03-06 07:10:00 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
ChatGPT初心者でもわかる 「Chain of Thought をPythonで100行で実装してみた」 |
https://qiita.com/sonesuke/items/b8ff4193ae08a499b671
|
https |
2023-03-06 07:03:49 |
Ruby |
Rubyタグが付けられた新着投稿 - Qiita |
文字列の左から何番目の文字を出力する |
https://qiita.com/meitetsusutsushima1/items/5bb243c7c20252e9bdf1
|
inputlinegets |
2023-03-06 07:59:05 |
海外TECH |
DEV Community |
manipulation Data Science |
https://dev.to/cromajetex/manipulation-data-science-3h48
|
manipulation Data Science Welcome to Data ScienceCongratulations on taking a big step toward becoming a data scientist In addition to working through this course be sure to take advantage of all of the learning support available to you on SoloLearn including the daily tips Try it Yourself practices code coach challenges code playground and engagement with our amazing learner community We love to hear from you so please leave comments and feedback as you learn with us or chart us at cromajet gmail com What is Data Science There are many use cases in business for data science including finding a better housing price prediction algorithm for Zillow finding key attributes associated with wine quality and building a recommendation system to increase the click through rate for Amazon Extracting insights from seemingly random data data science normally involves collecting data cleaning data performing exploratory data analysis building and evaluating machine learning models and communicating insights to stakeholders Also Data science is a multidisciplinary field that unifies statistics data analysis machine learning and their related methods to extract knowledge and insights In this Introduction to Data Science course we re learning data science with Python As a general purpose programming language Python is now the most popular programming language in data science It s easy to use has great community support and integrates well with other frameworks e g web applications in an engineering environment This course focuses on exploratory data analysis with three fundamental Python libraries numpy pandas and matplotlib The machine learning library scikit learn will be covered as well In the later modules we will be predicting home values using linear regression identifying classes of iris with classification algorithms and finding clusters within wines just a few examples of what we can do in data science Also In data science there are other popular programming languages such as R which has an edge in statistical modeling Numerical DataDatasets come from a wide range of sources and formats it could be collections of numerical measurements text corpus images audio clips or basically anything No matter the format the first step in data science is to transform it into arrays of numbers We collected U S president heights in centimeters in chronological order and stored them in a list a built in data type in python heights In this example George Washington was the first president and his height was cm If we wanted to know how many presidents are taller than cm we could iterate through the list compare each element against and increase the count by as the criteria is met heights cnt for height in heights if height gt cnt print cnt Introduction to NumpyNumpy short for Numerical Python allows us to find the answer to how many presidents are taller than cm with ease Below we show how to use the library and start with the basic object in numpy import numpy as npheights heights arr np array heights print heights arr gt sum The import statement allows us to access the functions and modules inside the numpy library The library will be used frequently so by convention numpy is imported under a shorter name np The second line is to convert the list into a numpy array object via np array that tools provided in numpy can work with The last line provides a simple and natural solution enabled by numpy to the original question As our datasets grow larger and more complicated numpy allows us the use of a more efficient and for loop free method to manipulate and analyze our data Our dataset example in this module will include the US Presidents height age and party NotePython modules can get access to code from another module by importing the file function using the import statement Size and ShapeAn array class in Numpy is called an ndarray or n dimensional array We can use this to count the number of presidents in heights arr use attribute numpy ndarray size import numpy as npheights heights arr np array heights print heights arr size Note that once an array is created in numpy its size cannot be changed Size tells us how big the array is shape tells us the dimension To get current shape of an array use attribute shape import numpy as npheights heights arr np array heights print heights arr shape The output is a tuple recall that the built in data type tuple is immutable whereas a list is mutable containing a single value indicating that there is only one dimension i e axis Along axis there are elements one for each president Here heights arr is a d array NOTE Attribute size in numpy is similar to the built in method len in python that is used to compute the length of iterable python objects like str list dict etc ReshapeOther data we have collected includes the ages of the presidents ages Since both heights and ages are all about the same presidents we can combine them import numpy as npheights ages heights and ages heights ages convert a list to a numpy arrayheights and ages arr np array heights and ages print heights and ages arr shape This produces one long array It would be clearer if we could align height and age for each president and reorganize the data into a by matrix where the first row contains all heights and the second row contains ages To achieve this a new array can be created by calling numpy ndarray reshape with new dimensions specified in a tuple import numpy as npheights ages heights and ages heights ages convert a list to a numpy arrayheights and ages arr np array heights and ages print heights and ages arr reshape The reshaped array is now a darray yet note that the original array is not changed We can reshape an array in multiple ways as long as the size of the reshaped array matches that of the original Numpy can calculate the shape dimension for us if we indicate the unknown dimension as For example given a darray arr of shape arr reshape would output a darray of shape while arr reshape would generate a darray of shape Data TypeAnother characteristic about numpy array is that it is homogeneous meaning each element must be of the same data type For example in heights arr we recorded all heights in whole numbers thus each element is stored as an integer in the array To check the data type use numpy ndarray dtypeimport numpy as npheights heights arr np array heights print heights arr dtype If we mixed a float number in say the first element is instead of heights float Then after converting the list into an array we d see all other numbers are coerced into floats import numpy as npheights float heights float arr np array heights float print heights float arr print n print heights float arr dtype Numpy supports several data types such as int integer float numeric floating point and bool boolean values True and False The number after the data type ex int represents the bitsize of the data type IndexingWe can use array indexing to select individual elements from arrays Like Python lists numpy index starts from To access the height of the rd president Thomas Jefferson in the darray heights arr import numpy as npheights heights arr np array heights print heights arr In a darray there are two axes axis and Axis runs downward down the rows whereas axis runs horizontally across the columns In the darrary heights and ages arr recall that its dimensions are To find Thomas Jefferson s age at the beginning of his presidency you would need to access the second row where ages are stored import numpy as npheights ages heights and ages heights agesheights and ages arr np array heights and ages heights and ages arr heights and ages arr reshape print heights and ages arr NOTE In darray the row is axis and the column is axis therefore to access a darray numpy first looks for the position in rows then in columns So in our example heights and ages arr we are accessing row ages column third president to find Thomas Jefferson s age SlicingWhat if we want to inspect the first three elements from the first row in a darray We use to select all the elements from the index up to but not including the ending index This is called slicing import numpy as npheights ages heights and ages heights agesheights and ages arr np array heights and ages heights and ages arr heights and ages arr reshape print heights and ages arr When the starting index is we can omit it as shown below When the starting index is we can omit it as shown below import numpy as npheights ages heights and ages heights agesheights and ages arr np array heights and ages heights and ages arr heights and ages arr reshape print heights and ages arr What if we d like to see the entire fourth column Specify this by using a as followsimport numpy as npheights ages heights and ages heights agesheights and ages arr np array heights and ages heights and ages arr heights and ages arr reshape print heights and ages arr Numpy slicing syntax follows that of a python list arr start stop step When any of these are unspecified they default to the values start stop size of dimension step Assigning Single ValuesSometimes you need to change the values of particular elements in the array For example we noticed the fourth entry in the heights arr was incorrect it should be instead of we can re assign the correct number by import numpy as npheights heights arr np array heights heights arr print heights arr In a darray single values can be assigned easily You can use indexing for one element For example change the fourth entry in heights arr to import numpy as npheights ages heights and ages heights ages heights and ages arr np array heights and ages heights and ages arr heights and ages arr reshape heights and ages arr print heights and ages arr Or we can use slicing for multiple elements For example to replace the first row by its mean in heights and ages arr numpy as npheights ages heights and ages heights ages heights and ages arr np array heights and ages heights and ages arr heights and ages arr reshape heights and ages arr print heights and ages arr We can also combine slicing to change any subset of the array For example to reassign to the left upper corner import numpy as npheights ages heights and ages heights agesheights and ages arr np array heights and ages heights and ages arr heights and ages arr reshape heights and ages arr print heights and ages arr NOTE It is easy to update values in a subarray when you combine arrays with slicing For more on basic slicing and advanced indexing in numpy check out this link Assigning an Array to an ArrayIn addition a darray or a darry can be assigned to a subset of another darray as long as their shapes match Recall the darray heights and ages arr import numpy as npheights ages heights and ages heights agesheights and ages arr np array heights and ages heights and ages arr heights and ages arr reshape print heights and ages arr If we want to update both height and age of the first president with new data we can supply the data in a list import numpy as npheights ages heights and ages heights agesheights and ages arr np array heights and ages heights and ages arr heights and ages arr reshape heights and ages arr print heights and ages arr We can also update data in a subarray with a numpy array as such import numpy as npheights ages heights and ages heights agesheights and ages arr np array heights and ages heights and ages arr heights and ages arr reshape new record np array heights and ages arr new recordprint heights and ages arr Note the last three columns values have changed Updating a multidimensional array with a new record is straightforward in numpy as long as their shapes match Combining Two ArraysOftentime we obtain data stored in different arrays and we need to combine them into one to keep it in one place For example instead of having the ages stored in a list it could be stored in a darray import numpy as npages ages arr np array ages print ages arr shape print ages arr If we reshape the heights arr to the same as ages arr we can stack them horizontally by column to get a darray using hstack import numpy as npheights ages heights arr np array heights ages arr np array ages heights arr heights arr reshape ages arr ages arr reshape height age arr np hstack heights arr ages arr print height age arr shape print height age arr Now height age arr has both heights and ages for the presidents each column corresponds to the height and age of one president Similarly if we want to combine the arrays vertically by row we can use vstack import numpy as npheights ages heights arr np array heights ages arr np array ages heights arr heights arr reshape ages arr ages arr reshape height age arr np vstack heights arr ages arr print height age arr shape print height age arr NOTE To combine more than two arrays horizontally simply add the additional arrays into the tuple ConcatenateMore generally we can use the function numpy concatenate If we want to concatenate link together two arrays along rows then pass axis to achieve the same result as using numpy hstack and pass axis if you want to combine arrays vertically In the example from the previous part we were using hstack to combine two arrays horizontally instead import numpy as npheights ages heights arr np array heights ages arr np array ages heights arr heights arr reshape ages arr ages arr reshape height age arr np hstack heights arr ages arr height age arr np concatenate heights arr ages arr axis print height age arr shape print height age arr Also you can get the same result as using vstack import numpy as npheights ages heights arr np array heights ages arr np array ages heights arr heights arr reshape ages arr ages arr reshape height age arr np vstack heights arr ages arr height age arr np concatenate heights arr ages arr axis print height age arr shape print height age arr NOTE You can use np hstack to concatenate arrays ONLY if they have the same number of rows Numpy Array MethodIn addition there are several methods in numpy to perform more complex calculations on arrays For example the sum method finds the sum of all the elements in an array import numpy as npheights arr np array ages arr np array reshape heights arr heights arr reshape height age arr np hstack heights arr ages arr print height age arr sum The sum of all heights and ages is In order to sum all heights and sum all ages separately we can specify axis to calculate the sum across the rows that is it computes the sum for each column or column sum On the other hand to obtain the row sums specify axis In this example we want to calculate the total sum of heights and ages respectively import numpy as npheights arr np array ages arr np array reshape heights arr heights arr reshape height age arr np hstack heights arr ages arr print height age arr sum axis The output is the row sums heights of all presidents i e the first row add up to and the sum of ages i e the second row is NOTE Other operations such as min max mean work in a similar way to sum ComparisonsIn practicing data science we often encounter comparisons to identify rows that match certain values We can use operations including lt gt gt lt and to do so For example in the height age arr dataset we might be interested in only those presidents who started their presidency younger than years old import numpy as npheights arr np array ages arr np array reshape heights arr heights arr reshape height age arr np hstack heights arr ages arr print height age arr lt The output is a darray with boolean values that indicates which presidents meet the criteria If we are only interested in which presidents started their presidency at years of age we can use instead import numpy as npheights arr np array ages arr np array reshape heights arr heights arr reshape height age arr np hstack heights arr ages arr print height age arr NOTE To find out how many rows satisfy the condition use sum on the resultant d boolean array e g height age arr sum to see that there were exactly five presidents who started the presidency at age True is treated as and False as in the sum Mask amp SubsettingNow that rows matching certain criteria can be identified a subset of the data can be found For example instead of the entire dataset we want only tall presidents that is those presidents whose height is greater than or equal to cm We first create a mask darray with boolean values import numpy as npheights arr np array ages arr np array reshape heights arr heights arr reshape height age arr np hstack heights arr ages arr mask height age arr gt print mask sum Then pass it to the first axis of height age arr to filter presidents who don t meet the criteria numpy as npheights arr np array ages arr np array reshape heights arr heights arr reshape height age arr np hstack heights arr ages arr mask height age arr gt tall presidents height age arr mask tall presidents shapeprint tall presidents shape This is a subarray of height age arr and all presidents in tall presidents were at least cm tall NOTE Masking is used to extract modify count or otherwise manipulate values in an array based on some criterion In our example the criteria was height of cm or taller Multiple CriteriaWe can create a mask satisfying more than one criteria For example in addition to height we want to find those presidents that were years old or younger at the start of their presidency To achieve this we use amp to separate the conditions and each condition is encapsulated with parentheses as shown below import numpy as npheights arr np array ages arr np array reshape heights arr heights arr reshape height age arr np hstack heights arr ages arr mask height age arr gt amp height age arr lt print height age arr mask The results show us that there are four presidents who satisfy both conditions NOTE Data manipulation in Python is nearly synonymous with Numpy array manipulation Operations shown here are the building blocks of many other examples used throughout this course It is important to master them Thank you for reading you can contact us for more at cromajet gmail comThe next book will follow as Data Analysis |
2023-03-05 22:44:11 |
海外TECH |
Engadget |
Microsoft is testing a redesigned Windows 11 audio mixer |
https://www.engadget.com/microsoft-is-testing-a-redesigned-windows-11-audio-mixer-224417187.html?src=rss
|
Microsoft is testing a redesigned Windows audio mixerWindows has frequently made managing multiple audio devices a hassle Over the years Microsoft has tried to improve the experience in a few ways In for example the company simplified how Windows categorized Bluetooth devices In spite of those efforts it often feels like the OS doesn t make switching between audio outputs and managing sound levels as easy as they should be For instance I wish Windows s Quick Setting panel would allow me to adjust audio levels on a per app basis Thankfully Microsoft is finally preparing to solve that minor annoyance for Windows users This week the company detailed the latest Windows Insider Preview and it just so happens to include a redesigned Quick Settings volume mixer The updated interface element not only allows you to switch between audio devices but you can also use it to enable spatial sound and adjust volume output on a per app basis two things you can t do with the current design What s more Microsoft has added a dedicated shortcut to make accessing the feature faster Once you have access to the volume mixer press the Windows Ctrl and V keys on your keyboard at the same time to open it quot With this change you can now tailor your audio experience with more control and fewer clicks to better manage your favorite apps quot Microsoft says of the redesigned interface As Bleeping Computer points out the new volume mixer is reminiscent of the popular EarTrumpet mod There s no word yet on when Microsoft plans to roll out the latest Windows Insider features to regular users but here s hoping this one doesn t take long to make its way to the general public MicrosoftThis article originally appeared on Engadget at |
2023-03-05 22:44:17 |
海外ニュース |
Japan Times latest articles |
Round 2 at your teaching job: New confidence, new opportunities |
https://www.japantimes.co.jp/community/2023/03/06/issues/round-2-teaching-job-new-confidence-new-opportunities/
|
newfound |
2023-03-06 07:00:44 |
ニュース |
BBC News - Home |
Bruno Fernandes a 'disgrace' & Manchester United 'eaten alive' in Liverpool thrashing |
https://www.bbc.co.uk/sport/football/64856857?at_medium=RSS&at_campaign=KARANGA
|
Bruno Fernandes a x disgrace x amp Manchester United x eaten alive x in Liverpool thrashingPundits held nothing back in their assessment of Manchester United s performance in Sunday s defeat at Liverpool describing it as a disgrace and a shambles |
2023-03-05 22:04:33 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
米、対中投資の新規則を準備 - WSJ発 |
https://diamond.jp/articles/-/318971
|
対中投資 |
2023-03-06 07:19:00 |
ビジネス |
東洋経済オンライン |
日経平均が一段高になるか大事な週がやってきた 日本株の「低PBR修正の動き」はバブルではない | 市場観測 | 東洋経済オンライン |
https://toyokeizai.net/articles/-/657045?utm_source=rss&utm_medium=http&utm_campaign=link_back
|
日経平均 |
2023-03-06 07:30:00 |
マーケティング |
MarkeZine |
アイレップ、playknotらと協業 国内外市場に向けたVR動画コンテンツ制作サービスの提供を開始 |
http://markezine.jp/article/detail/41559
|
playknot |
2023-03-06 07:30:00 |
マーケティング |
MarkeZine |
REVISIO、テレビ視聴の注視データを活用したコンサルティング支援サービスを開始 |
http://markezine.jp/article/detail/41509
|
revisio |
2023-03-06 07:15:00 |
マーケティング |
MarkeZine |
注目のマーケ関連トピックスをチェック!週間ニュースランキングTOP10【2/24~3/2】 |
http://markezine.jp/article/detail/41566
|
関連 |
2023-03-06 07:15:00 |
コメント
コメントを投稿