办公软件 2015.07.08 Microsoft Office for Mac(苹果版)全面兼容Windows和Mac平台. SQLPro for SQLite Mac. 2021-01-05 我在神界刷装备游戏. Update SQLite to the latest beta of 3.7.0. This provides much better server concurrency when the repository database file is set to WAL mode. (check-in: fb5f0c25 user: drh tags: trunk, release). 本帖最后由 苹果senior司机 于 2019-8-6 11:04 编辑 软件介绍: SQLPro for SQLite 是Mac系统的简单且强大SQLite编辑器。 功能介绍: 最好的基础 表创建,自定义查询,自动完成和内联数据过滤。只是你可以预期的一些基本功能。. C: sqlite sqlite3 SQLite version 3.29.0 2019-07-10 17:32:03 Enter '.help' for usage hints. Connected to a transient in-memory database. Sqlpro For Sqlite 2019 07 08 Ls 5.3 Sqlpro For Sqlite 2019 07 08 Ls 460 This is a searchable description of the content of a live stream recording, specifically 'Episode 14 – Exploring CAP service level features and annotations' in the 'Hands-on SAP dev with qmacro' series.
It is common when performing exploratory data analysis,for example when examining COVID-19 data with pandas,to load from files like a CSV, XML, or JSON into apandas DataFrame. You may then do some work with thedata in the DataFrame and want to store it in a more durable locationlike a relational database.
This tutorial walks through how to load a pandas DataFrame from a CSVfile, pull out some data from the full data set, then save thesubset of data to a SQLite database usingSQLAlchemy.
Configuring our development environment
Make sure you have Python 3 installed. As of right now,Python 3.8.2 is the latestversion of Python.
During this tutorial we're also going to use:
- pandas (project homepageand source code), version 1.0.3in this tutorial
- SQLAlchemy(project homepage andsource code), version 1.3.15for this tutorial
- SQLite (project homepageand source code),which Pythonincludes a connector for as part of the Python standard library
Install the above code libraries into a newPython virtual environmentusing the following commands:
Our development environment is nowready to download an example COVID-19 data set, load it into a pandasDataFrame, perform some analysis on it then save into a SQLite database.
Obtaining COVID-19 data
Go to thedownload today's data on the geographic distribution of COVID-19 cases worldwidepage in your web browser. Network utility x 6 0 2. It should look something like the followingscreenshot.
There should be a link to download thedata in CSV format, but the organization has changed the page layoutseveral times in the past few weeks, which makes it difficult to findformats other than Excel (XLSX). If you have trouble obtaining theCSV version, just downloadthis one from GitHubwhich is pegged to a copy downloaded on March 28th, 2020.
Importing the CSV into pandas
The raw data is in a CSV file and we need to load it into memory via apandas DataFrame.
Start by running the Python Read-Evaluate-Print Loop (REPL) on thecommand line:
The REPL is ready to execute code, but we first need to import the pandaslibrary so we can use it.
The data is now loaded into the df
variable which is an instance of thepandas DataFrameclass.
When we run the count
Sopotube for youtube adblock 1 0 download free. function on this DataFrame, we get back that ithas 7320 rows.
Next, we'll take this set of 7320 rows of data and slice out onlythe rows that pertain to the United States.
Creating a new DataFrame from the original DataFrame
We can pick out all of the rows of data for a single country usinga pandas function to match the countriesAndTerritories
columnto the country of our choice.
Sqlpro For Sqlite
The save_df
variable contains the smaller subset of data. You canfind out what's in it by having it print itself:
You should see something like the following output:
89 rows of data out of the original 7320 rows. Let's proceed withsaving this subset to a SQLite relational database.
Saving the DataFrame to SQLite
We are going to use SQLAlchemy to create a connectionto a new SQLite database, which in this example will be stored in filenamed save_pandas.db
. You can of course save the file with whatever nameyou want and in any location, not just the directory where you areexecuting the Python REPL.
Sqlpro For Mssql
Start by importing the create_engine
function from the sqlalchemy
library.
Sqlpro Sqlite
Create the connection using the imported create_engine
functionand then invoking the connect
method on it.
We set echo=True
to see all of the output that comes from ourdatabase connection. When the connection is successful you willsee output similar to the following:
Set a variable name with the string of a table name you would liketo create. Then use that variable when invoking the to_sql
method on the save_df
object, which is our pandas DataFrame thatis a subset of the original data set with 89 rows filtered fromthe original 7320.
Note that in this case we are going to fail if the table alreadyexists in the database. You can change if_exists
to to replace
or append
and add your own exception handling in a more robustversion of this program. Check thepandas.DataFrame.to_sqldocumentation for the extensive details on your options.
The echo output should spin up with a bunch of output.
Windowmizer 4 4 download free. Our table with all of its data should now be all set. Close the databaseconnection.
We can take a look at the data through the sqlite3
command line viewerto make sure it was properly saved to the SQLite file.
On the command line (not in the Python REPL), type:
This will open up the command line prompt to interact with SQLitedatabases. However, we are not yet connected to our save_pandas.db
file.
Use the .open
command with our save_pandas.db
file name toaccess the database. Then use a standard SQL query to obtain allof the records from the Covid19
table.
The SQLite explorer should produce output like you see below:
All of the data with the countriesAndTerritories
column matchingUnited_States_of_America
is there! We successfully exported thedata from the DataFrame into the SQLite database file.
What's Next?
We just imported data from a CSV into a pandas DataFrame, selected asubset of that data then saved it to a relational database.
You should take a look at theLearning pandas by Exploring COVID-19 Datatutorial to learn more about how to select subsets of data from alarger DataFrame, or head to the pandas page formore tutorials by the rest of the Python community.
You can also get an idea of what to code next in your Python project byreading theFull Stack Python table of contents page.
Questions? Contact me via Twitter@fullstackpythonor @mattmakai. I'm also on GitHub withthe username mattmakai.
Something wrong with this post? Forkthis page's source on GitHuband submit a pull request.