Replies: 1 comment 5 replies
-
Hi @ahershy You can use the SAVE keyword as shown here. If you need more help with this, just let me know. If you need to pull out the DataFrame: from fugue_sql import fsql
import pandas as pd
df = pd.DataFrame({"a": [1,2,3], "b": [1,2,3]})
res = fsql("""
SELECT *
FROM df
WHERE a > 2
YIELD DATAFRAME AS test
""").run()
print(res["test"].as_pandas().head()) |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I can see the first few rows printed in my IDE when using fsql(query).run(). However, I would like to export the whole query. How would I go about exporting to excel or text? It's a lot trickier than I thought. Below is the code and query I'm using. Everything works perfectly as planned, except I cannot export.
from fugue_sql import fsql
query = 'SELECT point, distancefrom, isitland FROM df WHERE isitland = "True" ORDER BY distancefrom LIMIT 50 PRINT'
fsql(query).run()
PandasDataFrame
point:str |distancefrom:double|isitland:str
-------------------------------------------------------------------+-------------------+------------
(53.6117, -166.59818) |1104.5381558307515 |True
(53.57895, -166.82095) |1106.2604760111058 |True
(53.6373, -166.76843) |1109.0255797929005 |True
(53.36486, -168.17752) |1118.1591199262448 |True
(53.17287, -168.7642) |1118.6132248530207 |True
(53.22795, -168.61332) |1118.7472352194661 |True
(53.90554, -166.36213) |1119.2786304419692 |True
(54.15937, -165.50491) |1122.6569154945525 |True
(53.97564, -166.36982) |1123.8576728572605 |True
(54.20736, -165.39408) |1124.2129127564162 |True
DataFrames()
Beta Was this translation helpful? Give feedback.
All reactions