Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
P
PyTicDB
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 2
    • Issues 2
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 1
    • Merge Requests 1
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Package Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • William Fong
  • PyTicDB
  • Merge Requests
  • !1

Open
Created Nov 16, 2022 by William Fong@wcfongMaintainer
  • Report abuse
Report abuse

WIP: Transforms

  • Overview 5
  • Commits 15
  • Changes 3

Create an interface where users can easily transform SQL returns from simple Lists to other datastructures.

import pyticdb

result = pyticdb.query.query_by_loc(30, 30, 5, "id", "tmag", "ra", "dec")
df = result.to(pd.DataFrame, columns=["id", "tmag", "ra", "dec"])
print(df)

#               id     tmag         ra        dec
#0       620522458  19.5013  26.517966  26.067170
#1        26854028  16.9362  26.554431  26.058153
#2       238602786  13.7684  25.831204  26.607332
#3        26780500  16.6801  25.749914  26.705586
#4        26780499  17.3535  25.751117  26.706271
#...           ...      ...        ...        ...
#465131   63673024  15.4218  33.113164  34.242920
#465132  620976192  18.9674  33.113467  34.242985
#465133  620976196  19.3668  33.100306  34.253915
#465134  620976198  19.5535  33.082656  34.263246
#465135  620976186  19.2301  33.122409  34.237523

#[465136 rows x 4 columns]

Additionally mapped collections may also be generated

result = pyticdb.query.query_by_loc(30, 30, 5, "id", "tmag", "ra", "dec")
mapping = result.to_mapping()
print(mapping)
#{
#...
# 620586895: (620586895, 18.2195, 25.9165267339, 26.7210167303),
# 26821818: (26821818, 17.4758, 25.9313564236, 26.7138267236),
# 26821816: (26821816, 17.4579, 25.9229220787, 26.7281658026),
# 620586896: (620586896, 19.5342, 25.9287999639, 26.7293418159),
# 238602753: (238602753, 17.287, 25.898837, 26.739758),
# 620586901: (620586901, 17.599, 25.9118859569, 26.7430910162),
#...
#}
print(mapping[620586901].tmag)
# 17.599
Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Source branch: transforms