Comments (4)
The import/export options of the script are mainly there to convert between different types of input files if you want to do that, so it doesn't make a lot of sense to go from CSV to CSV file. The script options are not particularly useful from an end-user perspective, but they make it relatively painless to ship with the most up-to-date version of the timezone map (which reminds me that I have to update that), and see whether you broke anything before you commit.
I am not a 100% sure I understand what you exactly want to do, but if you could elaborate a bit that would be great. I feel like I am now the one that is missing something obvious :)
You don't want to export polygons with timezone information by any chance?
from pytzwhere.
I simply need an offline way to append local time to a csv file with
lat/lon/timestamp (UTC). (Actually in my case it's a bunch of csv files at
once so I use glob.) I am doing analysis in R, and so in/out csv means I
can call it from R with 'system(python tzwhere.py)' and then call
'read_csv()" again easily to get the results back in. I've done a quick and
dirty implementation like so:
from tzwhere import tzwhere
import glob
import pandas as pd
def reader(f):
d = pd.read_csv(f, names=['id', 'latitude', 'longitude', 'timestamp'])
return d
def main():
files = glob.glob('*.csv')
data = pd.concat([reader(f) for f in files], ignore_index=True)
tz = tzwhere.tzwhere(shapely=True)
data['local_tz'] = data.apply(lambda row: tz.tzNameAt(row['latitude'],
row['longitude']), axis=1)
data.to_csv('to_r.csv', index=False)
if __name__ == "__main__":
main()
---------- Forwarded message ----------
From: cstich [email protected]
Date: Tue, Nov 17, 2015 at 6:34 PM
Subject: Re: [pytzwhere] Why can't one read and write both csv's? (#30)
To: pegler/pytzwhere [email protected]
Cc: Josie Kressner [email protected]
The import/export options of the script are mainly there to convert between
different types of input files if you want to do that, so it doesn't make a
lot of sense to go from CSV to CSV file. The script options are not
particularly useful from an end-user perspective, but they make it
relatively painless to ship with the most up-to-date version of the
timezone map (which reminds me that I have to update that), and see whether
you broke anything before you commit.
I am not a 100% sure I understand what you exactly want to do, but if you
could elaborate a bit that would be great. I feel like I am now the one
that is missing something obvious :)
You don't want to export polygons with timezone information by any chance?
β
Reply to this email directly or view it on GitHub
#30 (comment).
from pytzwhere.
Your code makes sense to me as it is. Pandas is probably a much better choice for doing all the reading and writing of CSV files than using anything in pytzwhere
for that. Does that answer your original question?
from pytzwhere.
Sure thing. I'll continue to use the script with pandas.
from pytzwhere.
Related Issues (20)
- Potentially wrong results returned HOT 17
- Upload 2.3 to pypi? HOT 3
- forceTZ returning unexpected result HOT 5
- all of China should be +0800, but some are showing up as +0600 HOT 5
- tzNameAt bombs with a KeyError on certain latitudes / longitudes HOT 1
- Outdated data HOT 1
- `tz_world_shortcuts.json` is missing from setup.py HOT 8
- package_data are not installed when installing pytzwhere with pip in a venv HOT 5
- tz_world.json.gz does not exits HOT 1
- What happened to tzOffsetAt?
- can't insatll pytzwhere on Win 10
- Add tests to PyPI source tarball? HOT 1
- With latest numpy update, generates an error on initialization HOT 7
- No timezone for Dubai HOT 1
- how to return this format as "GMT +9" or "GMT -5"οΌThx
- VisibleDeprecationWarning HOT 1
- ValueError due to shapely update HOT 5
- ModuleNotFoundError: No module named 'shapely.lib' HOT 2
- Constructor fails with value error
- Is this project still maintained?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytzwhere.