Message from Python discussions

December 2018

— Show the code.

— 

Guys can python read 2 files ?


‘’’filedir = directory + 'file1.csv'
filedir2 = directory + 'file2.csv'
dfstatinit = pd.read_csv(filedir)’’’

how can i add filedir2 into dfstatinit ?

— How to get that tag with what?

— You could read both files separately and then concatenate dataframes together:
https://pandas.pydata.org/pandas-docs/stable/merging.html

Message permanent page

— Problem is i dont wanna merge them 🙁

— Why?

— Cause they are written to non stop

— Its in a loop

— How to create a sqlite database locally in the folder where the script is running?

— Hello everyone!
I have next structure of files:
app
main.py
pack1
__init__.py
pack1_1
__init__.py
module1_1a.py
When I am importing the module:
`
import pack1.pack1_1.module1_1a
# sys.modules
print(“pack1.pack1_1.module1_1a” in sys.modules) # True
print(“pack1.pack1_1” in sys.modules) # True
print(“pack1” in sys.modules) # True

# globals()
print(“pack1.pack1_1.module1_1a” in globals()) # False
print(“pack1.pack1_1” in globals()) # False
print(“pack1” in globals()) # True
`
With sys.modules I understand why.
But I can’t understand why it works with globals()?

Message permanent page

— It does not work on my phone.

— 


app
main.py
pack1
__init__.py
pack1_1
__init__.py
module1_1a.py


When I am importing the module:


import pack1.pack1_1.module1_1a
# sys.modules
print(“pack1.pack1_1.module1_1a” in sys.modules) # True
print(“pack1.pack1_1” in sys.modules) # True
print(“pack1” in sys.modules) # True

# globals()
print(“pack1.pack1_1.module1_1a” in globals()) # False
print(“pack1.pack1_1” in globals()) # False
print(“pack1” in globals()) # True

Message permanent page