import os
import geopandas as gpd
import pandas as pd
file=os.listdir(r\\IP_Address\winshare\Affected_Area_Files)
path=[os.path.join(r\\IP_Address\winshare\Affected_Area_Files,i)
for i in file:
if".shp" in i:
# Below code need to be explained:
gdf=gpd.GeoDataFame(pd.concat([gpd.read_file(i).to_crs(gpd.read_file(path[0]).crs)for i in path],ignore_index=True),crs=gpd.read_file(path[0]).crs)
gdf.to_file(r\\IP_Address\winshare\affected_area\combined-AffectedArea_Test.shp)
I am new to python, the code has to be optimized for better performance.
It was running fine but now it is taking quite long to execute
I wrote a code to open a CSV file with pandas
from pandas import read_csv
print(read_csv("weather_data.csv"))
But when I tried to run it in PyCharm, a completely different code that I wrote weeks ago gets executed.
I checked that I execute the right file, and even deleted the project multiple times and created it in different locations.
Another thing that confuses me is when I edit this code to:
print("hello")
from random import randint
from pandas import read_csv
print("hello")
print(randint(1,10))
print(read_csv("weather_data (1).csv"))
the output is:
hello
Pls enter a number: (-> the game i made weeks ago)
This code seems to get executed when I import packages, because the print function before works fine.
I am trying to write a program that chooses a recipie for me to cook at random so i found a csv file to get the recipies from but when i tried running some code this happened.
I'm new to pandas so sorry if this is stupid
`
import random
import pandas as pd
import numpy as np
pd.read_csv('recipes.csv')
pd.isnull()
`
https://github.com/cweber/cookbook/blob/master/recipes.csv (this is the link to the csv file)
The following code ran in PYCHARM editor
import pandas as pd
df=pd.read_csv('Train_UWu5bXk.csv')
df.min()
the output is not showing any value
C:\Users\krishna\PycharmProjects\pdproject\Scripts\python.exe
C:/Users/krishna/Python37-32/Scripts/phythonncode/load1pandas.py
Process finished with exit code 0
someone can help me.
the problem is solved with the following code in python
import pandas as pd
df=pd.read_csv('Train_UWu5bXk.csv')
print(df.min())
Pandas has worked fine for me for years. All of a sudden, today, I am getting this error:
File "C:\Users\Excel\Anaconda3\lib\site-packages\dautil\data.py", line 3, in <module>
from pandas.io import wb
ImportError: cannot import name 'wb'
It seems like the error is coming form data.py. Here is a screen shot.
This seemed to happen all of a sudden, and the error is triggered when I run a few different processes that call this process. I uninstalled and re-installed pandas. I am still getting the same error.
The documentation says
Starting in 0.19.0, pandas no longer supports pandas.io.data or
pandas.io.wb, so you must replace your imports from pandas.io with
those from pandas_datareader:
So, as per documentation, you should be doing this:
from pandas.io import data, wb # becomes
from pandas_datareader import data, wb
Even with pandas_datareader, the same error may happen, if this your case, then you have two solutions
for Pandas >=0.23 make sure that your pandas_datareader is > = 0.7, if for some reason you don't want to upgrade pandas_datareader to 0.7, or downgrading the pandas_datareader, then alternavly, you can do:
import pandas as pd
pd.core.common.is_list_like = pd.api.types.is_list_like
import pandas_datareader as web